for the first time in forever
This commit is contained in:
parent
b618bb3a04
commit
92fcaf4af5
@ -7,4 +7,9 @@
|
|||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="SwUserDefinedSpecifications">
|
||||||
|
<option name="specTypeByUrl">
|
||||||
|
<map />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -7,7 +7,7 @@ import java.nio.file.Path;
|
|||||||
public class JAML {
|
public class JAML {
|
||||||
public static Path path;
|
public static Path path;
|
||||||
public static GuiHandler guiHandler;
|
public static GuiHandler guiHandler;
|
||||||
public static final String VERSION = "0.8.0";
|
public static final String VERSION = "0.8.2";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
@ -9,10 +9,49 @@ import java.io.InputStreamReader;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
|
private int jdkVersion;
|
||||||
|
private int memoryAmount;
|
||||||
|
private String garbageCollection;
|
||||||
|
private boolean printConsole;
|
||||||
//TODO add progressbar for launch progress
|
//TODO add progressbar for launch progress
|
||||||
//TODO add console output option
|
//TODO add console output option
|
||||||
|
|
||||||
public Launcher(int jdkVersion, int memoryAmount, String garbageCollection, boolean printConsole) {
|
public Launcher() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJdkVersion(int jdkVersion) {
|
||||||
|
this.jdkVersion = jdkVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getJdkVersion() {
|
||||||
|
return jdkVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMemoryAmount(int memoryAmount) {
|
||||||
|
this.memoryAmount = memoryAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMemoryAmount() {
|
||||||
|
return memoryAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGarbageCollection(String garbageCollection) {
|
||||||
|
this.garbageCollection = garbageCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGarbageCollection() {
|
||||||
|
return garbageCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrintConsole(boolean printConsole) {
|
||||||
|
this.printConsole = printConsole;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getPrintConsole() {
|
||||||
|
return printConsole;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void launch() {
|
||||||
try {
|
try {
|
||||||
ArrayList<String> commandArray = parseCommand(jdkVersion, memoryAmount, garbageCollection);
|
ArrayList<String> commandArray = parseCommand(jdkVersion, memoryAmount, garbageCollection);
|
||||||
|
|
||||||
|
@ -33,23 +33,38 @@ public class NewProfileGui extends JFrame {
|
|||||||
contentPane = new JPanel();
|
contentPane = new JPanel();
|
||||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
setContentPane(contentPane);
|
setContentPane(contentPane);
|
||||||
contentPane.setLayout(null);
|
SpringLayout sl_contentPane = new SpringLayout();
|
||||||
|
contentPane.setLayout(sl_contentPane);
|
||||||
|
|
||||||
JLabel profileNameLabel = new JLabel("Profile Name:");
|
JLabel profileNameLabel = new JLabel("Profile Name:");
|
||||||
profileNameLabel.setBounds(10, 14, 84, 31);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, profileNameLabel, 14, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, profileNameLabel, 10, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, profileNameLabel, 45, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, profileNameLabel, 94, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(profileNameLabel);
|
contentPane.add(profileNameLabel);
|
||||||
JTextField profileNameField = new JTextField(20);
|
JTextField profileNameField = new JTextField(20);
|
||||||
profileNameField.setBounds(94, 18, 231, 23);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, profileNameField, 18, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, profileNameField, 94, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, profileNameField, 41, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, profileNameField, 325, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(profileNameField);
|
contentPane.add(profileNameField);
|
||||||
|
|
||||||
JLabel gamePathLabel = new JLabel("Game Path:");
|
JLabel gamePathLabel = new JLabel("Game Path:");
|
||||||
gamePathLabel.setBounds(10, 56, 84, 31);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, gamePathLabel, 56, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, gamePathLabel, 10, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, gamePathLabel, 87, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, gamePathLabel, 94, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(gamePathLabel);
|
contentPane.add(gamePathLabel);
|
||||||
|
|
||||||
JButton gamePathButton = new JButton("...");
|
JButton gamePathButton = new JButton("...");
|
||||||
gamePathButton.setBounds(302, 60, 23, 23);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, gamePathButton, 60, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, gamePathButton, 302, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, gamePathButton, 325, SpringLayout.WEST, contentPane);
|
||||||
JTextField gamePathField = new JTextField(20);
|
JTextField gamePathField = new JTextField(20);
|
||||||
gamePathField.setBounds(94, 60, 209, 23);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, gamePathField, 60, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, gamePathField, 94, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, gamePathField, 83, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, gamePathField, 303, SpringLayout.WEST, contentPane);
|
||||||
gamePathButton.addActionListener(ae -> {
|
gamePathButton.addActionListener(ae -> {
|
||||||
JFileChooser fileChooser = new JFileChooser(System.getenv("APPDATA") + "\\.minecraft\\");
|
JFileChooser fileChooser = new JFileChooser(System.getenv("APPDATA") + "\\.minecraft\\");
|
||||||
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||||
@ -68,29 +83,49 @@ public class NewProfileGui extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JLabel versionLabel = new JLabel("Version:");
|
JLabel versionLabel = new JLabel("Version:");
|
||||||
versionLabel.setBounds(10, 98, 84, 31);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, versionLabel, 98, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, versionLabel, 10, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, versionLabel, 129, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, versionLabel, 94, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(versionLabel);
|
contentPane.add(versionLabel);
|
||||||
JComboBox<String> versionField = new JComboBox<>(versions.toArray(new String[versions.size()]));
|
JComboBox versionField = new JComboBox(versions.toArray(new String[versions.size()]));
|
||||||
versionField.setBounds(94, 102, 231, 23);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, versionField, 102, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, versionField, 94, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, versionField, 125, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, versionField, 325, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(versionField);
|
contentPane.add(versionField);
|
||||||
|
|
||||||
JLabel loaderLabel = new JLabel("Loader:");
|
JLabel loaderLabel = new JLabel("Loader:");
|
||||||
loaderLabel.setBounds(10, 140, 84, 31);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, loaderLabel, 140, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, loaderLabel, 10, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, loaderLabel, 171, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, loaderLabel, 94, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(loaderLabel);
|
contentPane.add(loaderLabel);
|
||||||
|
|
||||||
JComboBox<String> loaderDropdown = new JComboBox<>(LoaderUtils.getLoaders());
|
JComboBox loaderDropdown = new JComboBox(LoaderUtils.getLoaders());
|
||||||
loaderDropdown.setBounds(94, 144, 231, 23);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, loaderDropdown, 144, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, loaderDropdown, 94, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, loaderDropdown, 167, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, loaderDropdown, 325, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(loaderDropdown);
|
contentPane.add(loaderDropdown);
|
||||||
|
|
||||||
JLabel offlineModeLabel = new JLabel("Offline Mode:");
|
JLabel offlineModeLabel = new JLabel("Offline Mode:");
|
||||||
offlineModeLabel.setBounds(10, 182, 84, 31);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, offlineModeLabel, 182, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, offlineModeLabel, 10, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, offlineModeLabel, 213, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, offlineModeLabel, 94, SpringLayout.WEST, contentPane);
|
||||||
contentPane.add(offlineModeLabel);
|
contentPane.add(offlineModeLabel);
|
||||||
JCheckBox offlineModeBox = new JCheckBox("");
|
JCheckBox offlineModeBox = new JCheckBox("");
|
||||||
offlineModeBox.setBounds(94, 185, 21, 23);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, offlineModeBox, 185, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, offlineModeBox, 94, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, offlineModeBox, 208, SpringLayout.NORTH, contentPane);
|
||||||
contentPane.add(offlineModeBox);
|
contentPane.add(offlineModeBox);
|
||||||
|
|
||||||
JButton button = new JButton("Create Profile");
|
JButton button = new JButton("Create Profile");
|
||||||
button.setBounds(24, 243, 217, 37);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, button, 243, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, button, 24, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, button, 280, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, button, 241, SpringLayout.WEST, contentPane);
|
||||||
button.addActionListener(al -> {
|
button.addActionListener(al -> {
|
||||||
Profile profile = new Profile();
|
Profile profile = new Profile();
|
||||||
profile.setProfileName(profileNameField.getText());
|
profile.setProfileName(profileNameField.getText());
|
||||||
@ -111,7 +146,10 @@ public class NewProfileGui extends JFrame {
|
|||||||
contentPane.add(button);
|
contentPane.add(button);
|
||||||
|
|
||||||
JButton cancelButton = new JButton("Cancel");
|
JButton cancelButton = new JButton("Cancel");
|
||||||
cancelButton.setBounds(242, 243, 83, 37);
|
sl_contentPane.putConstraint(SpringLayout.NORTH, cancelButton, 243, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.WEST, cancelButton, 242, SpringLayout.WEST, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.SOUTH, cancelButton, 280, SpringLayout.NORTH, contentPane);
|
||||||
|
sl_contentPane.putConstraint(SpringLayout.EAST, cancelButton, 325, SpringLayout.WEST, contentPane);
|
||||||
cancelButton.addActionListener(al -> {
|
cancelButton.addActionListener(al -> {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
});
|
});
|
||||||
|
36
src/main/java/tech/nevets/jaml/gui/TestGui.java
Normal file
36
src/main/java/tech/nevets/jaml/gui/TestGui.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package tech.nevets.jaml.gui;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
|
||||||
|
public class TestGui extends JFrame {
|
||||||
|
public int buttons;
|
||||||
|
|
||||||
|
JPanel contentPane;
|
||||||
|
|
||||||
|
public TestGui() {
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setSize(1920, 1080);
|
||||||
|
contentPane = new JPanel();
|
||||||
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
|
setContentPane(contentPane);
|
||||||
|
contentPane.setLayout(null);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
int num = 5;
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
JButton button = new JButton();
|
||||||
|
button.setBounds(10, num, 10, 5);
|
||||||
|
contentPane.add(button);
|
||||||
|
num += 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestGui gui = new TestGui();
|
||||||
|
gui.setLocationRelativeTo(null);
|
||||||
|
gui.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package tech.nevets.jaml.gui.panels;
|
package tech.nevets.jaml.gui.panels;
|
||||||
|
|
||||||
|
|
||||||
import tech.nevets.jaml.JAML;
|
import tech.nevets.jaml.JAML;
|
||||||
import tech.nevets.jaml.Launcher;
|
import tech.nevets.jaml.Launcher;
|
||||||
import tech.nevets.jaml.util.ImageUtils;
|
import tech.nevets.jaml.util.ImageUtils;
|
||||||
@ -20,11 +19,16 @@ public class HomePanel extends JPanel {
|
|||||||
JButton launchButton = new JButton("Launch");
|
JButton launchButton = new JButton("Launch");
|
||||||
launchButton.setBounds(512, 619, 196, 51);
|
launchButton.setBounds(512, 619, 196, 51);
|
||||||
launchButton.addActionListener(al -> {
|
launchButton.addActionListener(al -> {
|
||||||
new Launcher(17, 6, "zgc", true);
|
Launcher launch = new Launcher();
|
||||||
|
launch.setJdkVersion(17);
|
||||||
|
launch.setMemoryAmount(6144);
|
||||||
|
launch.setGarbageCollection("zgc");
|
||||||
|
launch.setPrintConsole(true);
|
||||||
|
launch.launch();
|
||||||
});
|
});
|
||||||
add(launchButton);
|
add(launchButton);
|
||||||
|
|
||||||
JComboBox activeProfileDropdown = new JComboBox(ProfileUtils.profileList);
|
JComboBox<String> activeProfileDropdown = new JComboBox<>(ProfileUtils.profileList);
|
||||||
activeProfileDropdown.setBounds(858, 648, 196, 22);
|
activeProfileDropdown.setBounds(858, 648, 196, 22);
|
||||||
add(activeProfileDropdown);
|
add(activeProfileDropdown);
|
||||||
|
|
||||||
|
@ -1,9 +1,23 @@
|
|||||||
package tech.nevets.jaml.gui.panels;
|
package tech.nevets.jaml.gui.panels;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.Component;
|
||||||
|
|
||||||
public class ProfilePanel extends JPanel {
|
public class ProfilePanel extends JPanel {
|
||||||
public ProfilePanel() {
|
public ProfilePanel() {
|
||||||
|
SpringLayout springLayout = new SpringLayout();
|
||||||
|
setLayout(springLayout);
|
||||||
|
|
||||||
|
JComboBox profileDropDown = new JComboBox();
|
||||||
|
add(profileDropDown);
|
||||||
|
|
||||||
|
Component dropDownGlue = Box.createGlue();
|
||||||
|
springLayout.putConstraint(SpringLayout.NORTH, profileDropDown, 0, SpringLayout.NORTH, dropDownGlue);
|
||||||
|
springLayout.putConstraint(SpringLayout.WEST, profileDropDown, -80, SpringLayout.WEST, dropDownGlue);
|
||||||
|
springLayout.putConstraint(SpringLayout.EAST, profileDropDown, 30, SpringLayout.WEST, dropDownGlue);
|
||||||
|
springLayout.putConstraint(SpringLayout.NORTH, dropDownGlue, 16, SpringLayout.NORTH, this);
|
||||||
|
springLayout.putConstraint(SpringLayout.WEST, dropDownGlue, 242, SpringLayout.WEST, this);
|
||||||
|
add(dropDownGlue);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user