From 94d61f2181d66ad28439801d4e126dd657fb0e78 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 30 Jan 2018 23:34:25 +0100 Subject: [PATCH] GUI is no longer shit on linux --- .../META-INF/MANIFEST.MF | 3 ++ .../serverlauncher/userinterface/GUI.java | 28 +++++++------- .../userinterface/ServerTab.java | 38 +++++++++---------- 3 files changed, 36 insertions(+), 33 deletions(-) create mode 100644 out/production/Minecraft-Server-Launcher/META-INF/MANIFEST.MF diff --git a/out/production/Minecraft-Server-Launcher/META-INF/MANIFEST.MF b/out/production/Minecraft-Server-Launcher/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5ee19cb --- /dev/null +++ b/out/production/Minecraft-Server-Launcher/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: Main + diff --git a/src/net/knarcraft/serverlauncher/userinterface/GUI.java b/src/net/knarcraft/serverlauncher/userinterface/GUI.java index 9bb8efd..ee031a9 100644 --- a/src/net/knarcraft/serverlauncher/userinterface/GUI.java +++ b/src/net/knarcraft/serverlauncher/userinterface/GUI.java @@ -119,14 +119,14 @@ public class GUI implements ActionListener { * Initialize the contents of the frame. */ private void initialize() { - try { + /*try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | UnsupportedLookAndFeelException | InstantiationException | IllegalAccessException e) { e.printStackTrace(); - } + }*/ frame = new JFrame("Minecraft server launcher"); - frame.setBounds(100, 100, 398, 219); + frame.setBounds(100, 100, 490, 219); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setResizable(false); ImageIcon img; @@ -294,29 +294,29 @@ public class GUI implements ActionListener { sl_panel_1.putConstraint(SpringLayout.NORTH, btnKick, 9, SpringLayout.NORTH, controlServers); sl_panel_1.putConstraint(SpringLayout.WEST, btnKick, 6, SpringLayout.EAST, targetServer); sl_panel_1.putConstraint(SpringLayout.SOUTH, btnKick, 32, SpringLayout.NORTH, controlServers); - sl_panel_1.putConstraint(SpringLayout.EAST, btnKick, 84, SpringLayout.EAST, targetServer); + sl_panel_1.putConstraint(SpringLayout.EAST, btnKick, 124, SpringLayout.EAST, targetServer); controlServers.add(btnKick); btnKick.addActionListener(this); btnBan = new JButton("Ban"); sl_panel_1.putConstraint(SpringLayout.NORTH, btnBan, 35, SpringLayout.NORTH, controlServers); sl_panel_1.putConstraint(SpringLayout.WEST, btnBan, 6, SpringLayout.EAST, targetPlayer); - sl_panel_1.putConstraint(SpringLayout.EAST, btnBan, 84, SpringLayout.EAST, targetPlayer); + sl_panel_1.putConstraint(SpringLayout.EAST, btnBan, 124, SpringLayout.EAST, targetPlayer); controlServers.add(btnBan); btnBan.addActionListener(this); btnOp = new JButton("OP"); sl_panel_1.putConstraint(SpringLayout.NORTH, btnOp, 9, SpringLayout.NORTH, controlServers); - sl_panel_1.putConstraint(SpringLayout.WEST, btnOp, 287, SpringLayout.WEST, controlServers); + sl_panel_1.putConstraint(SpringLayout.WEST, btnOp, 6, SpringLayout.EAST, btnKick); sl_panel_1.putConstraint(SpringLayout.SOUTH, btnOp, 32, SpringLayout.NORTH, controlServers); - sl_panel_1.putConstraint(SpringLayout.EAST, btnOp, 370, SpringLayout.WEST, controlServers); + sl_panel_1.putConstraint(SpringLayout.EAST, btnOp, 124, SpringLayout.EAST, btnKick); controlServers.add(btnOp); btnOp.addActionListener(this); btnDeop = new JButton("DEOP"); - sl_panel_1.putConstraint(SpringLayout.WEST, btnDeop, 287, SpringLayout.WEST, controlServers); + sl_panel_1.putConstraint(SpringLayout.WEST, btnDeop, 6, SpringLayout.EAST, btnBan); sl_panel_1.putConstraint(SpringLayout.NORTH, btnDeop, 35, SpringLayout.NORTH, controlServers); - sl_panel_1.putConstraint(SpringLayout.EAST, btnDeop, 370, SpringLayout.WEST, controlServers); + sl_panel_1.putConstraint(SpringLayout.EAST, btnDeop, 124, SpringLayout.EAST, btnBan); controlServers.add(btnDeop); btnDeop.addActionListener(this); @@ -351,13 +351,13 @@ public class GUI implements ActionListener { sl_panel_1.putConstraint(SpringLayout.NORTH, customCommand, 6, SpringLayout.SOUTH, btnSaveserver); sl_panel_1.putConstraint(SpringLayout.NORTH, btnSaveserver, 6, SpringLayout.SOUTH, btnBan); sl_panel_1.putConstraint(SpringLayout.WEST, btnSaveserver, 0, SpringLayout.WEST, btnKick); - sl_panel_1.putConstraint(SpringLayout.EAST, btnSaveserver, 91, SpringLayout.WEST, btnKick); + sl_panel_1.putConstraint(SpringLayout.EAST, btnSaveserver, 120, SpringLayout.WEST, btnKick); controlServers.add(btnSaveserver); btnSaveserver.addActionListener(this); btnReload = new JButton("Reload"); sl_panel_1.putConstraint(SpringLayout.NORTH, btnReload, 6, SpringLayout.SOUTH, btnDeop); - sl_panel_1.putConstraint(SpringLayout.WEST, btnReload, 10, SpringLayout.WEST, btnDeop); + sl_panel_1.putConstraint(SpringLayout.WEST, btnReload, 0, SpringLayout.WEST, btnDeop); sl_panel_1.putConstraint(SpringLayout.EAST, btnReload, 0, SpringLayout.EAST, btnOp); controlServers.add(btnReload); btnReload.addActionListener(this); @@ -377,13 +377,15 @@ public class GUI implements ActionListener { JTabbedPane tabbedPane_1 = new JTabbedPane(JTabbedPane.TOP); sl_panel_2.putConstraint(SpringLayout.NORTH, tabbedPane_1, 0, SpringLayout.NORTH, panel_2); sl_panel_2.putConstraint(SpringLayout.WEST, tabbedPane_1, 0, SpringLayout.WEST, panel_2); - sl_panel_2.putConstraint(SpringLayout.SOUTH, tabbedPane_1, 150, SpringLayout.NORTH, panel_2); - sl_panel_2.putConstraint(SpringLayout.EAST, tabbedPane_1, 396, SpringLayout.WEST, panel_2); + sl_panel_2.putConstraint(SpringLayout.SOUTH, tabbedPane_1, 0, SpringLayout.SOUTH, panel_2); + sl_panel_2.putConstraint(SpringLayout.EAST, tabbedPane_1, 0, SpringLayout.EAST, panel_2); panel_2.add(tabbedPane_1); this.serversPane = tabbedPane_1; tabbedPane_1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); + frame.setPreferredSize(frame.getPreferredSize()); + frame.validate(); frame.setVisible(true); } diff --git a/src/net/knarcraft/serverlauncher/userinterface/ServerTab.java b/src/net/knarcraft/serverlauncher/userinterface/ServerTab.java index 6adf52d..035a4ad 100644 --- a/src/net/knarcraft/serverlauncher/userinterface/ServerTab.java +++ b/src/net/knarcraft/serverlauncher/userinterface/ServerTab.java @@ -33,21 +33,22 @@ public class ServerTab implements ActionListener { sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerType, 30, SpringLayout.NORTH, panel); panel.add(lblServerType); - serverTypes = new JComboBox<>(ServerType.getTypeNames()); - sl_panel_3.putConstraint(SpringLayout.NORTH, serverTypes, 10, SpringLayout.NORTH, panel); - sl_panel_3.putConstraint(SpringLayout.WEST, serverTypes, 16, SpringLayout.EAST, lblServerType); - panel.add(serverTypes); - serverTypes.addActionListener(this); - JLabel lblServerVersion = new JLabel("Server version"); sl_panel_3.putConstraint(SpringLayout.NORTH, lblServerVersion, 6, SpringLayout.SOUTH, lblServerType); sl_panel_3.putConstraint(SpringLayout.WEST, lblServerVersion, 10, SpringLayout.WEST, panel); sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerVersion, 26, SpringLayout.SOUTH, lblServerType); panel.add(lblServerVersion); + serverTypes = new JComboBox<>(ServerType.getTypeNames()); + sl_panel_3.putConstraint(SpringLayout.NORTH, serverTypes, 10, SpringLayout.NORTH, panel); + sl_panel_3.putConstraint(SpringLayout.WEST, serverTypes, 5, SpringLayout.EAST, lblServerVersion); + panel.add(serverTypes); + serverTypes.addActionListener(this); + serverVersions = new JComboBox<>(ServerType.getServerTypes().get(0).getVersions()); sl_panel_3.putConstraint(SpringLayout.NORTH, serverVersions, 6, SpringLayout.SOUTH, serverTypes); - sl_panel_3.putConstraint(SpringLayout.WEST, serverVersions, 0, SpringLayout.WEST, serverTypes); + sl_panel_3.putConstraint(SpringLayout.EAST, serverVersions, 0, SpringLayout.EAST, serverTypes); + sl_panel_3.putConstraint(SpringLayout.WEST, serverVersions, 6, SpringLayout.EAST, lblServerVersion); panel.add(serverVersions); serverVersions.addActionListener(this); @@ -61,7 +62,7 @@ public class ServerTab implements ActionListener { maxRam = new JComboBox<>(Server.getRamList()); sl_panel_3.putConstraint(SpringLayout.NORTH, maxRam, 10, SpringLayout.NORTH, panel); sl_panel_3.putConstraint(SpringLayout.WEST, maxRam, 6, SpringLayout.EAST, lblMaxRam); - sl_panel_3.putConstraint(SpringLayout.EAST, maxRam, 86, SpringLayout.EAST, lblMaxRam); + sl_panel_3.putConstraint(SpringLayout.EAST, maxRam, -10, SpringLayout.EAST, panel); panel.add(maxRam); maxRam.addActionListener(this); @@ -72,25 +73,21 @@ public class ServerTab implements ActionListener { chckbxEnabled.addActionListener(this); btnRemoveServer = new JButton("Remove server"); - sl_panel_3.putConstraint(SpringLayout.NORTH, btnRemoveServer, 5, SpringLayout.SOUTH, lblMaxRam); - sl_panel_3.putConstraint(SpringLayout.SOUTH, btnRemoveServer, -64, SpringLayout.SOUTH, panel); - sl_panel_3.putConstraint(SpringLayout.SOUTH, maxRam, -5, SpringLayout.NORTH, btnRemoveServer); - sl_panel_3.putConstraint(SpringLayout.EAST, serverVersions, -13, SpringLayout.WEST, btnRemoveServer); - sl_panel_3.putConstraint(SpringLayout.WEST, btnRemoveServer, 239, SpringLayout.WEST, panel); - sl_panel_3.putConstraint(SpringLayout.EAST, btnRemoveServer, 0, SpringLayout.EAST, maxRam); + sl_panel_3.putConstraint(SpringLayout.NORTH, btnRemoveServer, 0, SpringLayout.NORTH, serverVersions); + sl_panel_3.putConstraint(SpringLayout.SOUTH, btnRemoveServer, 0, SpringLayout.SOUTH, serverVersions); + sl_panel_3.putConstraint(SpringLayout.WEST, btnRemoveServer, 6, SpringLayout.EAST, serverVersions); + sl_panel_3.putConstraint(SpringLayout.EAST, btnRemoveServer, -10, SpringLayout.EAST, panel); panel.add(btnRemoveServer); btnRemoveServer.addActionListener(this); JLabel lblDirectory = new JLabel("Directory"); sl_panel_3.putConstraint(SpringLayout.NORTH, lblDirectory, 1, SpringLayout.NORTH, chckbxEnabled); sl_panel_3.putConstraint(SpringLayout.SOUTH, lblDirectory, 0, SpringLayout.SOUTH, chckbxEnabled); + sl_panel_3.putConstraint(SpringLayout.WEST, lblDirectory, 6, SpringLayout.EAST, chckbxEnabled); panel.add(lblDirectory); directory = new JTextField(); - sl_panel_3.putConstraint(SpringLayout.NORTH, directory, 4, SpringLayout.SOUTH, btnRemoveServer); - sl_panel_3.putConstraint(SpringLayout.SOUTH, directory, -37, SpringLayout.SOUTH, panel); - sl_panel_3.putConstraint(SpringLayout.EAST, lblDirectory, -6, SpringLayout.WEST, directory); - sl_panel_3.putConstraint(SpringLayout.WEST, directory, 130, SpringLayout.WEST, panel); + sl_panel_3.putConstraint(SpringLayout.WEST, directory, 6, SpringLayout.EAST, lblDirectory); panel.add(directory); directory.setColumns(10); directory.addActionListener(this); @@ -98,8 +95,9 @@ public class ServerTab implements ActionListener { btnBrowse = new JButton("Browse"); sl_panel_3.putConstraint(SpringLayout.EAST, directory, -6, SpringLayout.WEST, btnBrowse); sl_panel_3.putConstraint(SpringLayout.NORTH, btnBrowse, 3, SpringLayout.SOUTH, btnRemoveServer); - sl_panel_3.putConstraint(SpringLayout.WEST, btnBrowse, 293, SpringLayout.WEST, panel); - sl_panel_3.putConstraint(SpringLayout.EAST, btnBrowse, 0, SpringLayout.EAST, maxRam); + sl_panel_3.putConstraint(SpringLayout.EAST, btnBrowse, -10, SpringLayout.EAST, panel); + sl_panel_3.putConstraint(SpringLayout.SOUTH, directory, 0, SpringLayout.SOUTH, btnBrowse); + sl_panel_3.putConstraint(SpringLayout.NORTH, directory, 0, SpringLayout.NORTH, btnBrowse); panel.add(btnBrowse); btnBrowse.addActionListener(this); }