diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java index 4536137..b9438a0 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java @@ -18,6 +18,7 @@ public class ControlPanelTab implements ActionListener { private JButton stopServerButton; private JButton backupButton; private JButton addProfileButton; + private JButton showConsolesButton; private JButton deleteProfileButton; private JComboBox profiles; private final JPanel controlPanelPanel; @@ -147,13 +148,25 @@ public class ControlPanelTab implements ActionListener { controlPanelPanel.add(stopServerButton); stopServerButton.addActionListener(this); - JLabel lblProfile = new JLabel("Profile"); - springLayout.putConstraint(SpringLayout.NORTH, lblProfile, 6, SpringLayout.SOUTH, startServerButton); - springLayout.putConstraint(SpringLayout.WEST, lblProfile, 10, SpringLayout.WEST, controlPanelPanel); - controlPanelPanel.add(lblProfile); + showConsolesButton = new JButton("View server consoles"); + springLayout.putConstraint(SpringLayout.NORTH, showConsolesButton, 0, SpringLayout.NORTH, stopServerButton); + springLayout.putConstraint(SpringLayout.WEST, showConsolesButton, 6, SpringLayout.EAST, stopServerButton); + controlPanelPanel.add(showConsolesButton); + showConsolesButton.addActionListener(this); + + backupButton = new JButton("Backup"); + springLayout.putConstraint(SpringLayout.NORTH, backupButton, 0, SpringLayout.NORTH, showConsolesButton); + springLayout.putConstraint(SpringLayout.WEST, backupButton, 6, SpringLayout.EAST, showConsolesButton); + controlPanelPanel.add(backupButton); + backupButton.addActionListener(this); + + JLabel profileLabel = new JLabel("Profile"); + springLayout.putConstraint(SpringLayout.NORTH, profileLabel, 6, SpringLayout.SOUTH, startServerButton); + springLayout.putConstraint(SpringLayout.WEST, profileLabel, 10, SpringLayout.WEST, controlPanelPanel); + controlPanelPanel.add(profileLabel); addProfileButton = new JButton("+"); - springLayout.putConstraint(SpringLayout.NORTH, addProfileButton, 6, SpringLayout.SOUTH, lblProfile); + springLayout.putConstraint(SpringLayout.NORTH, addProfileButton, 6, SpringLayout.SOUTH, profileLabel); springLayout.putConstraint(SpringLayout.WEST, addProfileButton, 10, SpringLayout.WEST, controlPanelPanel); controlPanelPanel.add(addProfileButton); addProfileButton.addActionListener(this); @@ -177,12 +190,6 @@ public class ControlPanelTab implements ActionListener { springLayout.putConstraint(SpringLayout.EAST, statusLabel, -10, SpringLayout.EAST, controlPanelPanel); statusLabel.setFont(new Font("", Font.BOLD, 12)); controlPanelPanel.add(statusLabel); - - backupButton = new JButton("Backup"); - springLayout.putConstraint(SpringLayout.NORTH, backupButton, 0, SpringLayout.NORTH, startServerButton); - springLayout.putConstraint(SpringLayout.WEST, backupButton, 6, SpringLayout.EAST, stopServerButton); - controlPanelPanel.add(backupButton); - backupButton.addActionListener(this); } @Override @@ -203,6 +210,8 @@ public class ControlPanelTab implements ActionListener { deleteProfile(); } else if (actionSource == profiles) { changeProfile(); + } else if (actionSource == showConsolesButton) { + ServerConsoles.setAsVisible(); } } } diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerControlTab.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerControlTab.java index e7f1bcf..2fa5f75 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerControlTab.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerControlTab.java @@ -22,7 +22,6 @@ public class ServerControlTab implements ActionListener { private JButton customCommandButton; private JButton saveServerButton; private JButton reloadButton; - private JButton showConsolesButton; private JTextField customCommandTextField; private final ServerLauncherController controller = ServerLauncherController.getInstance(); @@ -134,13 +133,6 @@ public class ServerControlTab implements ActionListener { springLayout.putConstraint(SpringLayout.EAST, reloadButton, 0, SpringLayout.EAST, opButton); controlServers.add(reloadButton); reloadButton.addActionListener(this); - - showConsolesButton = new JButton("View server consoles"); - springLayout.putConstraint(SpringLayout.NORTH, showConsolesButton, 0, SpringLayout.NORTH, saveServerButton); - springLayout.putConstraint(SpringLayout.WEST, showConsolesButton, 0, SpringLayout.WEST, lblTargetServer); - springLayout.putConstraint(SpringLayout.EAST, showConsolesButton, 0, SpringLayout.EAST, targetServerCombo); - controlServers.add(showConsolesButton); - showConsolesButton.addActionListener(this); } /** @@ -181,9 +173,7 @@ public class ServerControlTab implements ActionListener { //Registers actions on all commands executed on a specific server handleServerCommands(actionSource, selectedServerValue); - if (actionSource == showConsolesButton) { - ServerConsoles.setAsVisible(); - } else if (actionSource == targetServerCombo) { + if (actionSource == targetServerCombo) { updatePlayers(); } } diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java index f2657a7..89eead9 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java @@ -336,7 +336,7 @@ public class ServerLauncherGUI extends MessageHandler implements ActionListener, */ public void updateGUIElementsWhenServersStartOrStop(boolean running) { boolean stopped = !running; //Most gui is only enabled when the server is stopped rather than running. - //mainTabbedPane.setEnabledAt(1, !stopped); + mainTabbedPane.setEnabledAt(1, !stopped); mainTabbedPane.setEnabledAt(2, stopped); controlPanelTab.updateGUIElementsWhenServersStartOrStop(running); }