GUI size is now saved and loaded, to prevent hassle for the user
This commit is contained in:
@ -62,7 +62,13 @@ public class GUI implements ActionListener {
|
||||
* Create the application window.
|
||||
*/
|
||||
public GUI() {
|
||||
initialize();
|
||||
initialize(440, 170);
|
||||
loadMessages();
|
||||
this.globalPlayers = new ArrayList<>();
|
||||
}
|
||||
|
||||
public GUI(int width, int height) {
|
||||
initialize(width, height);
|
||||
loadMessages();
|
||||
this.globalPlayers = new ArrayList<>();
|
||||
}
|
||||
@ -96,6 +102,10 @@ public class GUI implements ActionListener {
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getSize() {
|
||||
return frame.getContentPane().getPreferredSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates GUI according to current settings.
|
||||
*/
|
||||
@ -117,7 +127,7 @@ public class GUI implements ActionListener {
|
||||
/**
|
||||
* Creates the GUI,
|
||||
*/
|
||||
private void initialize() {
|
||||
private void initialize(int width, int height) {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (ClassNotFoundException |
|
||||
@ -130,7 +140,7 @@ public class GUI implements ActionListener {
|
||||
|
||||
frame = new JFrame("Minecraft server launcher");
|
||||
frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
//frame.setResizable(false);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(width, height));
|
||||
ImageIcon img;
|
||||
try {
|
||||
img = new ImageIcon(ImageIO.read(GUI.class.getResourceAsStream("/files/GUIIcon.png")));
|
||||
@ -381,7 +391,6 @@ public class GUI implements ActionListener {
|
||||
this.serversPane = tabbedPane_1;
|
||||
tabbedPane_1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||
|
||||
frame.getContentPane().setPreferredSize(new Dimension(440, 170));
|
||||
frame.validate();
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
|
@ -37,7 +37,7 @@ public class ServerTab implements ActionListener {
|
||||
public ServerTab(String name) {
|
||||
this.name = name;
|
||||
panel = new JPanel();
|
||||
Main.gui().getPane().addTab(name, null, panel, null);
|
||||
Profile.getGUI().getPane().addTab(name, null, panel, null);
|
||||
SpringLayout sl_panel_3 = new SpringLayout();
|
||||
panel.setLayout(sl_panel_3);
|
||||
|
||||
@ -171,7 +171,7 @@ public class ServerTab implements ActionListener {
|
||||
|
||||
private void remove() {
|
||||
Profile.getCurrent().removeCollection(name);
|
||||
Main.gui().update();
|
||||
Profile.getGUI().update();
|
||||
Profile.getCurrent().updateConsoles();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user