This commit is contained in:
Downforce Agent 2024-04-12 10:21:51 -05:00
parent 767fd8fd0f
commit 37900e8f2e
2 changed files with 52 additions and 11 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="MissPiggy"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="MissPiggy">
<grid id="27dc6" binding="frameContainer" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="frameContainer" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="5" left="5" bottom="5" right="5"/>
<constraints> <constraints>
<xy x="20" y="20" width="500" height="400"/> <xy x="20" y="20" width="500" height="400"/>
</constraints> </constraints>
@ -117,7 +117,7 @@
<text value="Import"/> <text value="Import"/>
</properties> </properties>
</component> </component>
<component id="dd9e7" class="javax.swing.JButton" binding="generateButton" default-binding="true"> <component id="dd9e7" class="javax.swing.JButton" binding="deployButton" default-binding="true">
<constraints> <constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="4" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"> <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="4" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="79" height="28"/> <preferred-size width="79" height="28"/>
@ -125,7 +125,7 @@
</grid> </grid>
</constraints> </constraints>
<properties> <properties>
<text value="Generate"/> <text value="Deploy"/>
</properties> </properties>
</component> </component>
</children> </children>

View File

@ -18,26 +18,33 @@
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE; import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
public class MissPiggy { public class MissPiggy implements ActionListener {
JFrame frame = new JFrame(); JFrame frame = new JFrame();
JPanel frameContainer; JPanel frameContainer;
JPanel actionsContainer; JPanel actionsContainer;
JPanel descriptionContainer; JPanel descriptionContainer;
JMenuBar menuBar; //JPanel menuBarContainerPanel = new JPanel();
JMenu menu; public JMenuBar menuBar;
JMenuItem menuItem; public JMenu fileMenu;
public JMenu toolsMenu;
public JMenu helpMenu;
//JMenuItem menuItem;
JScrollPane modListScrollContainer; JScrollPane modListScrollContainer;
JList<String/*Main.Mod*/> modList; public JList<String/*Main.Mod*/> modList;
private JButton toggleButton; private JButton toggleButton;
private JButton moveUpButton; private JButton moveUpButton;
private JButton deleteButton1; private JButton deleteButton1;
private JButton moveDownButton; private JButton moveDownButton;
private JButton optionsButton; private JButton optionsButton;
private JButton importButton; private JButton importButton;
private JButton generateButton; private JButton deployButton;
private int selectedItem; private int selectedItem;
@ -59,10 +66,37 @@ public class MissPiggy {
Main.Mods.add(testModEntry); Main.Mods.add(testModEntry);
///-/////-/// ///-/////-///
InitializeModListInGUI(); // populate menu bar
menuBar = new JMenuBar();
fileMenu = new JMenu("File");
toolsMenu = new JMenu("Tools");
helpMenu = new JMenu("Help");
fileMenu.add(new JMenuItem("Deploy All Mods"));
fileMenu.add(new JMenuItem("Import Mod..."));
fileMenu.add(new JMenuItem("Remove All"));
fileMenu.add(new JSeparator());
fileMenu.add(new JMenuItem("Options"));
fileMenu.add(new JMenuItem("Quit"));
toolsMenu.add(new JMenuItem("Edit Metadata")); // disabled if a mod is not selected from the list
toolsMenu.add(new JMenuItem("Generate New Mod from Folder..."));
helpMenu.add(new JMenuItem("About Firestar"));
menuBar.add(fileMenu);
menuBar.add(toolsMenu);
menuBar.add(helpMenu);
menuBar.setVisible(true);
frame.setJMenuBar(menuBar);
frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA
InitializeModListInGUI(); // present mod list
fileMenu.getItem(5).addActionListener(this);
// display window
frame.setSize(800, 600); // 1280 800 frame.setSize(800, 600); // 1280 800
frame.setTitle("Firestar Mod Manager"); frame.setTitle("Firestar Mod Manager");
frame.setResizable(true); frame.setResizable(true);
@ -80,7 +114,9 @@ public class MissPiggy {
int i = 0; int i = 0;
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()) {
modList.add(new JLabel(Main.Mods.get(i).friendlyName)); JLabel label = new JLabel(Main.Mods.get(i).friendlyName);
label.setVisible(true);
modList.add(label);
//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";}
@ -89,4 +125,9 @@ public class MissPiggy {
i++; i++;
} }
} }
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getSource() == fileMenu.getItem(5)) {System.exit(0);}
}
} }