Moves the show consoles button to the main control panel
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
Also makes the control servers tab hidden if the servers are not running
This commit is contained in:
parent
8f25fa2796
commit
166d63f1b2
@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user