i'm living a lie

This commit is contained in:
Downforce Agent 2024-04-19 17:00:20 -05:00
parent 10b4a91515
commit cc2c143ff2
2 changed files with 13 additions and 5 deletions

View File

@ -32,7 +32,10 @@
<children> <children>
<component id="d80ff" class="javax.swing.JList" binding="modList"> <component id="d80ff" class="javax.swing.JList" binding="modList">
<constraints/> <constraints/>
<properties/> <properties>
<foreground color="-16777216"/>
<valueIsAdjusting value="false"/>
</properties>
<clientProperties> <clientProperties>
<html.disable class="java.lang.Boolean" value="true"/> <html.disable class="java.lang.Boolean" value="true"/>
</clientProperties> </clientProperties>

View File

@ -37,7 +37,7 @@ public class MissPiggy implements ActionListener {
//JMenuItem menuItem; //JMenuItem menuItem;
JScrollPane modListScrollContainer; JScrollPane modListScrollContainer;
public JList<String/*Main.Mod*/> modList; public JList<String/*JLabel*/> modList;
private JButton toggleButton; private JButton toggleButton;
private JButton moveUpButton; private JButton moveUpButton;
private JButton deleteButton1; private JButton deleteButton1;
@ -117,16 +117,20 @@ public class MissPiggy implements ActionListener {
// cleanup // cleanup
modList.clearSelection(); modList.clearSelection();
modList.removeAll(); modList.removeAll();
modList.setVisibleRowCount(Main.Mods.size());
modList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// todo this needs fixing before we can map it to Main.Mods and finish the other functionality around it // todo this needs fixing before we can map it to Main.Mods and finish the other functionality around it
// add text entry for each // add text entry for each
int i = 0; int i = 0;
/*JLabel[]*/String[] contents = new String[Main.Mods.size()];
System.out.println("Initializing modList to GUI with length of" + Main.Mods.size() + "units"); //debug System.out.println("Initializing modList to GUI with length of" + Main.Mods.size() + "units"); //debug
while (i < Main.Mods.size()) { while (i < Main.Mods.size()) {
JLabel label = new JLabel(Main.Mods.get(i).friendlyName); //JLabel label = new JLabel(Main.Mods.get(i).friendlyName);
label.setVisible(true); //label.setVisible(true);
modList.add(label); //contents[i] = label; //modList.add(label);
contents[i] = Main.Mods.get(i).friendlyName;
//debug //debug
if (Main.Mods.get(i).author == null) {Main.Mods.get(i).author = "Anonymous";} if (Main.Mods.get(i).author == null) {Main.Mods.get(i).author = "Anonymous";}
@ -134,6 +138,7 @@ public class MissPiggy implements ActionListener {
i++; i++;
} }
modList.setListData(contents);
} }
@Override @Override