From 3467c900f0f5005cf0b0f934eb0d411bc6df0fd6 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Fri, 1 Oct 2021 01:09:34 +0200 Subject: [PATCH] Changes some variable names --- .../userinterface/ControlPanelTab.java | 52 +++++++++---------- .../userinterface/ServerLauncherGUI.java | 30 +++++------ 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java index a1ad38c..872f20d 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ControlPanelTab.java @@ -21,7 +21,7 @@ public class ControlPanelTab implements ActionListener { private JComboBox profiles; private final JPanel controlPanelPanel; private final ServerLauncherController controller; - private final JLabel lblStatusLabel = new JLabel("Servers are stopped"); + private final JLabel statusLabel = new JLabel("Servers are stopped"); public ControlPanelTab(JPanel controlPanelPanel) { this.controlPanelPanel = controlPanelPanel; @@ -34,7 +34,7 @@ public class ControlPanelTab implements ActionListener { * @param text

The new text of the status label

*/ public void setStatusText(String text) { - this.lblStatusLabel.setText(text); + this.statusLabel.setText(text); } /** @@ -126,59 +126,59 @@ public class ControlPanelTab implements ActionListener { } private void initialize() { - SpringLayout sl_panel = new SpringLayout(); - controlPanelPanel.setLayout(sl_panel); + SpringLayout springLayout = new SpringLayout(); + controlPanelPanel.setLayout(springLayout); JLabel lblBasicControls = new JLabel("Basic controls"); - sl_panel.putConstraint(SpringLayout.NORTH, lblBasicControls, 10, SpringLayout.NORTH, controlPanelPanel); + springLayout.putConstraint(SpringLayout.NORTH, lblBasicControls, 10, SpringLayout.NORTH, controlPanelPanel); controlPanelPanel.add(lblBasicControls); startServerButton = new JButton("Start servers"); - sl_panel.putConstraint(SpringLayout.WEST, lblBasicControls, 0, SpringLayout.WEST, startServerButton); - sl_panel.putConstraint(SpringLayout.NORTH, startServerButton, 6, SpringLayout.SOUTH, lblBasicControls); - sl_panel.putConstraint(SpringLayout.WEST, startServerButton, 10, SpringLayout.WEST, controlPanelPanel); + springLayout.putConstraint(SpringLayout.WEST, lblBasicControls, 0, SpringLayout.WEST, startServerButton); + springLayout.putConstraint(SpringLayout.NORTH, startServerButton, 6, SpringLayout.SOUTH, lblBasicControls); + springLayout.putConstraint(SpringLayout.WEST, startServerButton, 10, SpringLayout.WEST, controlPanelPanel); controlPanelPanel.add(startServerButton); startServerButton.addActionListener(this); stopServerButton = new JButton("Stop servers"); - sl_panel.putConstraint(SpringLayout.NORTH, stopServerButton, 0, SpringLayout.NORTH, startServerButton); - sl_panel.putConstraint(SpringLayout.WEST, stopServerButton, 6, SpringLayout.EAST, startServerButton); + springLayout.putConstraint(SpringLayout.NORTH, stopServerButton, 0, SpringLayout.NORTH, startServerButton); + springLayout.putConstraint(SpringLayout.WEST, stopServerButton, 6, SpringLayout.EAST, startServerButton); controlPanelPanel.add(stopServerButton); stopServerButton.addActionListener(this); JLabel lblProfile = new JLabel("Profile"); - sl_panel.putConstraint(SpringLayout.NORTH, lblProfile, 6, SpringLayout.SOUTH, startServerButton); - sl_panel.putConstraint(SpringLayout.WEST, lblProfile, 10, SpringLayout.WEST, controlPanelPanel); + springLayout.putConstraint(SpringLayout.NORTH, lblProfile, 6, SpringLayout.SOUTH, startServerButton); + springLayout.putConstraint(SpringLayout.WEST, lblProfile, 10, SpringLayout.WEST, controlPanelPanel); controlPanelPanel.add(lblProfile); addProfileButton = new JButton("+"); - sl_panel.putConstraint(SpringLayout.NORTH, addProfileButton, 6, SpringLayout.SOUTH, lblProfile); - sl_panel.putConstraint(SpringLayout.WEST, addProfileButton, 10, SpringLayout.WEST, controlPanelPanel); + springLayout.putConstraint(SpringLayout.NORTH, addProfileButton, 6, SpringLayout.SOUTH, lblProfile); + springLayout.putConstraint(SpringLayout.WEST, addProfileButton, 10, SpringLayout.WEST, controlPanelPanel); controlPanelPanel.add(addProfileButton); addProfileButton.addActionListener(this); deleteProfileButton = new JButton("-"); - sl_panel.putConstraint(SpringLayout.NORTH, deleteProfileButton, 0, SpringLayout.NORTH, addProfileButton); - sl_panel.putConstraint(SpringLayout.WEST, deleteProfileButton, 6, SpringLayout.EAST, addProfileButton); + springLayout.putConstraint(SpringLayout.NORTH, deleteProfileButton, 0, SpringLayout.NORTH, addProfileButton); + springLayout.putConstraint(SpringLayout.WEST, deleteProfileButton, 6, SpringLayout.EAST, addProfileButton); controlPanelPanel.add(deleteProfileButton); deleteProfileButton.addActionListener(this); profiles = new JComboBox<>(); - sl_panel.putConstraint(SpringLayout.NORTH, profiles, 0, SpringLayout.NORTH, addProfileButton); - sl_panel.putConstraint(SpringLayout.WEST, profiles, 6, SpringLayout.EAST, deleteProfileButton); - sl_panel.putConstraint(SpringLayout.EAST, profiles, 124, SpringLayout.EAST, deleteProfileButton); + springLayout.putConstraint(SpringLayout.NORTH, profiles, 0, SpringLayout.NORTH, addProfileButton); + springLayout.putConstraint(SpringLayout.WEST, profiles, 6, SpringLayout.EAST, deleteProfileButton); + springLayout.putConstraint(SpringLayout.EAST, profiles, 124, SpringLayout.EAST, deleteProfileButton); controlPanelPanel.add(profiles); profiles.addActionListener(this); - sl_panel.putConstraint(SpringLayout.NORTH, lblStatusLabel, 6, SpringLayout.SOUTH, addProfileButton); - sl_panel.putConstraint(SpringLayout.SOUTH, lblStatusLabel, -10, SpringLayout.SOUTH, controlPanelPanel); - sl_panel.putConstraint(SpringLayout.WEST, lblStatusLabel, 10, SpringLayout.WEST, controlPanelPanel); - sl_panel.putConstraint(SpringLayout.EAST, lblStatusLabel, -10, SpringLayout.EAST, controlPanelPanel); - controlPanelPanel.add(lblStatusLabel); + springLayout.putConstraint(SpringLayout.NORTH, statusLabel, 6, SpringLayout.SOUTH, addProfileButton); + springLayout.putConstraint(SpringLayout.SOUTH, statusLabel, -10, SpringLayout.SOUTH, controlPanelPanel); + springLayout.putConstraint(SpringLayout.WEST, statusLabel, 10, SpringLayout.WEST, controlPanelPanel); + springLayout.putConstraint(SpringLayout.EAST, statusLabel, -10, SpringLayout.EAST, controlPanelPanel); + controlPanelPanel.add(statusLabel); backupButton = new JButton("Backup"); - sl_panel.putConstraint(SpringLayout.NORTH, backupButton, 0, SpringLayout.NORTH, startServerButton); - sl_panel.putConstraint(SpringLayout.WEST, backupButton, 6, SpringLayout.EAST, stopServerButton); + springLayout.putConstraint(SpringLayout.NORTH, backupButton, 0, SpringLayout.NORTH, startServerButton); + springLayout.putConstraint(SpringLayout.WEST, backupButton, 6, SpringLayout.EAST, stopServerButton); controlPanelPanel.add(backupButton); backupButton.addActionListener(this); } diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java index 53dc88c..f2657a7 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/ServerLauncherGUI.java @@ -264,25 +264,23 @@ public class ServerLauncherGUI extends MessageHandler implements ActionListener, mainTabbedPane.addTab("Control panel", null, controlPanelPanel, null); controlPanelTab = new ControlPanelTab(controlPanelPanel); - JPanel controlServers = new JPanel(); - mainTabbedPane.addTab("Control servers", null, controlServers, null); + JPanel controlServersPanel = new JPanel(); + mainTabbedPane.addTab("Control servers", null, controlServersPanel, null); + serverControlTab = new ServerControlTab(frame, controlServersPanel); - serverControlTab = new ServerControlTab(frame, controlServers); + JPanel serversPanel = new JPanel(); + mainTabbedPane.addTab("Servers", null, serversPanel, null); + SpringLayout serversPanelSpringLayout = new SpringLayout(); + serversPanel.setLayout(serversPanelSpringLayout); - JPanel panel_2 = new JPanel(); - mainTabbedPane.addTab("Servers", null, panel_2, null); - SpringLayout sl_panel_2 = new SpringLayout(); - panel_2.setLayout(sl_panel_2); + serversPane = new JTabbedPane(JTabbedPane.TOP); + serversPanelSpringLayout.putConstraint(SpringLayout.NORTH, serversPane, 0, SpringLayout.NORTH, serversPanel); + serversPanelSpringLayout.putConstraint(SpringLayout.WEST, serversPane, 0, SpringLayout.WEST, serversPanel); + serversPanelSpringLayout.putConstraint(SpringLayout.SOUTH, serversPane, 0, SpringLayout.SOUTH, serversPanel); + serversPanelSpringLayout.putConstraint(SpringLayout.EAST, serversPane, 0, SpringLayout.EAST, serversPanel); + serversPanel.add(serversPane); - 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, 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); + serversPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); frame.validate(); frame.pack();