GUI attempt #2
This commit is contained in:
parent
a24144bb18
commit
2aeba11874
@ -2,6 +2,7 @@ import net.knarcraft.serverlauncher.server.*;
|
||||
import net.knarcraft.serverlauncher.userinterface.GUI;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.awt.*;
|
||||
//Java 9 required.
|
||||
|
||||
/**
|
||||
@ -14,9 +15,18 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
class Main {
|
||||
public static void main(String[] args) {
|
||||
EventQueue.invokeLater(() -> {
|
||||
try {
|
||||
setup();
|
||||
new GUI();
|
||||
|
||||
GUI window = new GUI();
|
||||
window.getFrame().setVisible(true);
|
||||
window.addServer("Server 1");
|
||||
window.addServer("Server 2");
|
||||
window.addServer("Server 3");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void setup() {
|
||||
|
@ -1,147 +1,329 @@
|
||||
package net.knarcraft.serverlauncher.userinterface;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A class for creating the gui.
|
||||
*
|
||||
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
||||
* @version 0.0.0.1
|
||||
* @since 0.0.0.1
|
||||
*/
|
||||
public class GUI {
|
||||
|
||||
private JFrame frame;
|
||||
private JTabbedPane serversPane;
|
||||
|
||||
/**
|
||||
* Create the application.
|
||||
*/
|
||||
public GUI() {
|
||||
initialize();
|
||||
}
|
||||
|
||||
public JFrame getFrame() {
|
||||
return this.frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the contents of the frame.
|
||||
*/
|
||||
private void initialize() {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (ClassNotFoundException | UnsupportedLookAndFeelException | InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
JFrame frame = new JFrame("Minecraft server launcher");
|
||||
ImageIcon img;
|
||||
try {
|
||||
img = new ImageIcon(ImageIO.read(GUI.class.getResourceAsStream("/files/GUIIcon.png")));
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
img = new ImageIcon("files/GUIIcon.png");
|
||||
}
|
||||
frame.setIconImage(img.getImage());
|
||||
frame.setLocation(0,0);
|
||||
frame = new JFrame();
|
||||
frame.setBounds(100, 100, 391, 219);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setResizable(false);
|
||||
|
||||
JMenuBar menu = new JMenuBar();
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
frame.setJMenuBar(menuBar);
|
||||
|
||||
// A menu containing a user's options
|
||||
JMenu optionsMenu = new JMenu("Options");
|
||||
JCheckBoxMenuItem backgroundMode = new JCheckBoxMenuItem("Run in background on exit");
|
||||
JCheckBoxMenuItem delayStartup = new JCheckBoxMenuItem("Delay startup");
|
||||
JCheckBoxMenuItem downloadJars = new JCheckBoxMenuItem("Download Jars");
|
||||
JMenu mnOptions = new JMenu("Options");
|
||||
menuBar.add(mnOptions);
|
||||
|
||||
// A menu containing helpful information
|
||||
JMenu helpMenu = new JMenu("Help");
|
||||
JMenuItem errors = new JMenuItem("Errors");
|
||||
JMenuItem setup = new JMenuItem("Setup");
|
||||
JMenuItem warning = new JMenuItem("Warning");
|
||||
JMenuItem manualUpdate = new JMenuItem("Manual update");
|
||||
JCheckBoxMenuItem chckbxmntmRunInBackground = new JCheckBoxMenuItem("Run in background on exit");
|
||||
mnOptions.add(chckbxmntmRunInBackground);
|
||||
|
||||
// A menu containing various information
|
||||
JMenu infoMenu = new JMenu("Info");
|
||||
JMenu options = new JMenu("Options");
|
||||
JMenu about = new JMenu("About");
|
||||
JMenuItem backgroundModeInfo = new JMenuItem("Run in background on exit");
|
||||
JMenuItem delayStartupInfo = new JMenuItem("Delay Startup");
|
||||
JMenuItem downloadJarsInfo = new JMenuItem("Download jars");
|
||||
JMenuItem aboutAbout = new JMenuItem("About");
|
||||
JMenuItem aboutStory = new JMenuItem("Story");
|
||||
JCheckBoxMenuItem chckbxmntmDelayStartup = new JCheckBoxMenuItem("Delay Startup");
|
||||
mnOptions.add(chckbxmntmDelayStartup);
|
||||
|
||||
// Connects menu items to each other
|
||||
optionsMenu.add(backgroundMode);
|
||||
optionsMenu.add(delayStartup);
|
||||
optionsMenu.add(downloadJars);
|
||||
menu.add(optionsMenu);
|
||||
helpMenu.add(errors);
|
||||
helpMenu.add(setup);
|
||||
helpMenu.add(warning);
|
||||
helpMenu.add(manualUpdate);
|
||||
menu.add(helpMenu);
|
||||
options.add(backgroundModeInfo);
|
||||
options.add(delayStartupInfo);
|
||||
options.add(downloadJarsInfo);
|
||||
infoMenu.add(options);
|
||||
about.add(aboutAbout);
|
||||
about.add(aboutStory);
|
||||
infoMenu.add(about);
|
||||
menu.add(infoMenu);
|
||||
frame.setJMenuBar(menu);
|
||||
JCheckBoxMenuItem chckbxmntmDownloadJars = new JCheckBoxMenuItem("Download jars");
|
||||
mnOptions.add(chckbxmntmDownloadJars);
|
||||
|
||||
JTabbedPane tabs = new JTabbedPane(SwingConstants.TOP);
|
||||
//First tab
|
||||
JPanel controlPanel = new JPanel();
|
||||
controlPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
GroupLayout controlLayout = new GroupLayout(controlPanel);
|
||||
GroupLayout controlLayout2 = new GroupLayout(controlPanel);
|
||||
controlPanel.setLayout(controlLayout);
|
||||
JLabel basicControls = customLabel("Basic controls");
|
||||
JButton sendStart = customButton("Start servers");
|
||||
JButton sendStop = customButton("Stop servers");
|
||||
JButton backup = customButton("Backup");
|
||||
JButton viewConsole = customButton("View server consoles");
|
||||
JLabel profile = customLabel("Profile");
|
||||
JButton addProfile = customButton("+");
|
||||
JButton delProfile = customButton("-");
|
||||
JComboBox<String> profiles = new JComboBox<>(new String[]{"Default"});
|
||||
JMenu mnHelp = new JMenu("Help");
|
||||
menuBar.add(mnHelp);
|
||||
|
||||
controlLayout.setVerticalGroup(
|
||||
controlLayout.createSequentialGroup()
|
||||
.addGroup(controlLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(basicControls))
|
||||
.addGroup(controlLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(sendStart)
|
||||
.addComponent(sendStop)
|
||||
.addComponent(backup)
|
||||
.addComponent(viewConsole)));
|
||||
JMenuItem mntmErrors = new JMenuItem("Errors");
|
||||
mnHelp.add(mntmErrors);
|
||||
|
||||
controlLayout.setHorizontalGroup(
|
||||
controlLayout.createSequentialGroup()
|
||||
.addGroup(controlLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addComponent(basicControls)
|
||||
.addComponent(sendStart))
|
||||
.addGroup(controlLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addComponent(sendStop))
|
||||
.addGroup(controlLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addComponent(backup))
|
||||
.addGroup(controlLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addComponent(viewConsole)));
|
||||
JMenuItem mntmSetup = new JMenuItem("Setup");
|
||||
mnHelp.add(mntmSetup);
|
||||
|
||||
JMenuItem mntmWarning = new JMenuItem("Warning");
|
||||
mnHelp.add(mntmWarning);
|
||||
|
||||
tabs.addTab("Control panel", null, controlPanel, "Basic server controls");
|
||||
JMenuItem mntmManualUpdate = new JMenuItem("Manual update");
|
||||
mnHelp.add(mntmManualUpdate);
|
||||
|
||||
JPanel serversPanel = new JPanel();
|
||||
tabs.addTab("Control servers", null, serversPanel, "Easy server commands");
|
||||
JMenu mnInfo = new JMenu("Info");
|
||||
menuBar.add(mnInfo);
|
||||
|
||||
frame.add(tabs);
|
||||
JMenu mnOptions_1 = new JMenu("Options");
|
||||
mnInfo.add(mnOptions_1);
|
||||
|
||||
// TODO: Finish gui
|
||||
JMenuItem mntmRunInBackground = new JMenuItem("Run in background on exit");
|
||||
mnOptions_1.add(mntmRunInBackground);
|
||||
|
||||
JMenuItem mntmDelayStartup = new JMenuItem("Delay Startup");
|
||||
mnOptions_1.add(mntmDelayStartup);
|
||||
|
||||
frame.setVisible(true);
|
||||
JMenuItem mntmDownloadJars = new JMenuItem("Download jars");
|
||||
mnOptions_1.add(mntmDownloadJars);
|
||||
|
||||
JMenu mnAbout = new JMenu("About");
|
||||
mnInfo.add(mnAbout);
|
||||
|
||||
Insets insets = frame.getInsets();
|
||||
frame.setSize(450 + 2 * insets.left, 170 + insets.top + insets.bottom);
|
||||
JMenuItem mntmAbout = new JMenuItem("About");
|
||||
mnAbout.add(mntmAbout);
|
||||
|
||||
JMenuItem mntmStory = new JMenuItem("Story");
|
||||
mnAbout.add(mntmStory);
|
||||
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.X_AXIS));
|
||||
|
||||
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
||||
frame.getContentPane().add(tabbedPane);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
tabbedPane.addTab("Control panel", null, panel, null);
|
||||
SpringLayout sl_panel = new SpringLayout();
|
||||
panel.setLayout(sl_panel);
|
||||
|
||||
JLabel lblBasicControls = new JLabel("Basic controls");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, lblBasicControls, 10, SpringLayout.NORTH, panel);
|
||||
panel.add(lblBasicControls);
|
||||
|
||||
JButton btnStartServer = new JButton("Start servers");
|
||||
sl_panel.putConstraint(SpringLayout.WEST, lblBasicControls, 0, SpringLayout.WEST, btnStartServer);
|
||||
sl_panel.putConstraint(SpringLayout.SOUTH, lblBasicControls, -6, SpringLayout.NORTH, btnStartServer);
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, btnStartServer, 30, SpringLayout.NORTH, panel);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, btnStartServer, 10, SpringLayout.WEST, panel);
|
||||
panel.add(btnStartServer);
|
||||
|
||||
JButton btnStopServer = new JButton("Stop servers");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, btnStopServer, 0, SpringLayout.NORTH, btnStartServer);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, btnStopServer, 6, SpringLayout.EAST, btnStartServer);
|
||||
panel.add(btnStopServer);
|
||||
|
||||
JLabel lblProfile = new JLabel("Profile");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, lblProfile, 6, SpringLayout.SOUTH, btnStartServer);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, lblProfile, 10, SpringLayout.WEST, panel);
|
||||
panel.add(lblProfile);
|
||||
|
||||
JButton button = new JButton("+");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, button, 6, SpringLayout.SOUTH, lblProfile);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, button, 10, SpringLayout.WEST, panel);
|
||||
panel.add(button);
|
||||
|
||||
JButton button_1 = new JButton("-");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, button_1, 0, SpringLayout.NORTH, button);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, button_1, 6, SpringLayout.EAST, button);
|
||||
panel.add(button_1);
|
||||
|
||||
JComboBox comboBox = new JComboBox();
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, comboBox, 1, SpringLayout.NORTH, button);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, comboBox, 6, SpringLayout.EAST, button_1);
|
||||
sl_panel.putConstraint(SpringLayout.EAST, comboBox, 124, SpringLayout.EAST, button_1);
|
||||
panel.add(comboBox);
|
||||
|
||||
JLabel lblStatuslabel = new JLabel("StatusLabel");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, lblStatuslabel, 15, SpringLayout.SOUTH, button);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, lblStatuslabel, 10, SpringLayout.WEST, panel);
|
||||
sl_panel.putConstraint(SpringLayout.EAST, lblStatuslabel, 386, SpringLayout.WEST, panel);
|
||||
panel.add(lblStatuslabel);
|
||||
|
||||
JButton button_3 = new JButton("Add server");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, button_3, 0, SpringLayout.NORTH, btnStartServer);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, button_3, 6, SpringLayout.EAST, btnStopServer);
|
||||
panel.add(button_3);
|
||||
|
||||
JButton button_4 = new JButton("Backup");
|
||||
sl_panel.putConstraint(SpringLayout.NORTH, button_4, 0, SpringLayout.NORTH, btnStartServer);
|
||||
sl_panel.putConstraint(SpringLayout.WEST, button_4, 6, SpringLayout.EAST, button_3);
|
||||
panel.add(button_4);
|
||||
|
||||
JPanel panel_1 = new JPanel();
|
||||
tabbedPane.addTab("Control servers", null, panel_1, null);
|
||||
SpringLayout sl_panel_1 = new SpringLayout();
|
||||
panel_1.setLayout(sl_panel_1);
|
||||
|
||||
JComboBox comboBox_1 = new JComboBox();
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, comboBox_1, 10, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, comboBox_1, 30, SpringLayout.NORTH, panel_1);
|
||||
panel_1.add(comboBox_1);
|
||||
|
||||
JComboBox comboBox_2 = new JComboBox();
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, comboBox_2, 6, SpringLayout.SOUTH, comboBox_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, comboBox_2, 26, SpringLayout.SOUTH, comboBox_1);
|
||||
comboBox_2.setEditable(true);
|
||||
panel_1.add(comboBox_2);
|
||||
|
||||
JButton btnKick = new JButton("Kick");
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnKick, 9, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnKick, 6, SpringLayout.EAST, comboBox_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, btnKick, 32, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnKick, 84, SpringLayout.EAST, comboBox_1);
|
||||
panel_1.add(btnKick);
|
||||
|
||||
JButton btnBan = new JButton("Ban");
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnBan, 35, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnBan, 6, SpringLayout.EAST, comboBox_2);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnBan, 84, SpringLayout.EAST, comboBox_2);
|
||||
panel_1.add(btnBan);
|
||||
|
||||
JButton btnOp = new JButton("OP");
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnOp, 9, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnOp, 287, SpringLayout.WEST, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.SOUTH, btnOp, 32, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnOp, 370, SpringLayout.WEST, panel_1);
|
||||
panel_1.add(btnOp);
|
||||
|
||||
JButton btnDeop = new JButton("DEOP");
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnDeop, 287, SpringLayout.WEST, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnDeop, 35, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnDeop, 370, SpringLayout.WEST, panel_1);
|
||||
panel_1.add(btnDeop);
|
||||
|
||||
JLabel lblTargetServer = new JLabel("Target server");
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, comboBox_1, 6, SpringLayout.EAST, lblTargetServer);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, comboBox_1, 121, SpringLayout.EAST, lblTargetServer);
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, lblTargetServer, 10, SpringLayout.NORTH, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, lblTargetServer, 10, SpringLayout.WEST, panel_1);
|
||||
panel_1.add(lblTargetServer);
|
||||
|
||||
JLabel lblTargetPlayer = new JLabel("Target player");
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, comboBox_2, 7, SpringLayout.EAST, lblTargetPlayer);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, comboBox_2, 122, SpringLayout.EAST, lblTargetPlayer);
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, lblTargetPlayer, 12, SpringLayout.SOUTH, lblTargetServer);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, lblTargetPlayer, 0, SpringLayout.WEST, lblTargetServer);
|
||||
panel_1.add(lblTargetPlayer);
|
||||
|
||||
JButton btnCustomCommand = new JButton("Custom command");
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, btnCustomCommand, 250, SpringLayout.WEST, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, btnCustomCommand, 0, SpringLayout.EAST, btnOp);
|
||||
panel_1.add(btnCustomCommand);
|
||||
|
||||
JTextField textField = new JTextField();
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, textField, 10, SpringLayout.WEST, panel_1);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, textField, -6, SpringLayout.WEST, btnCustomCommand);
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, btnCustomCommand, -1, SpringLayout.NORTH, textField);
|
||||
panel_1.add(textField);
|
||||
textField.setColumns(10);
|
||||
|
||||
JButton button_2 = new JButton("Save server");
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, textField, 6, SpringLayout.SOUTH, button_2);
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, button_2, 6, SpringLayout.SOUTH, btnBan);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, button_2, 0, SpringLayout.WEST, btnKick);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, button_2, 91, SpringLayout.WEST, btnKick);
|
||||
panel_1.add(button_2);
|
||||
|
||||
JButton button_5 = new JButton("Reload");
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, button_5, 6, SpringLayout.SOUTH, btnDeop);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, button_5, 10, SpringLayout.WEST, btnDeop);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, button_5, 0, SpringLayout.EAST, btnOp);
|
||||
panel_1.add(button_5);
|
||||
|
||||
JButton button_6 = new JButton("View server consoles");
|
||||
sl_panel_1.putConstraint(SpringLayout.NORTH, button_6, 0, SpringLayout.NORTH, button_2);
|
||||
sl_panel_1.putConstraint(SpringLayout.WEST, button_6, 0, SpringLayout.WEST, lblTargetServer);
|
||||
sl_panel_1.putConstraint(SpringLayout.EAST, button_6, 0, SpringLayout.EAST, comboBox_1);
|
||||
panel_1.add(button_6);
|
||||
|
||||
JPanel panel_2 = new JPanel();
|
||||
tabbedPane.addTab("Servers", null, panel_2, null);
|
||||
SpringLayout sl_panel_2 = new SpringLayout();
|
||||
panel_2.setLayout(sl_panel_2);
|
||||
|
||||
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);
|
||||
panel_2.add(tabbedPane_1);
|
||||
|
||||
this.serversPane = tabbedPane_1;
|
||||
}
|
||||
|
||||
private JButton customButton(String text) {
|
||||
JButton button = new JButton(text);
|
||||
button.setMargin(new Insets(3,5,3,5));
|
||||
return button;
|
||||
}
|
||||
private JLabel customLabel(String text) {
|
||||
JLabel label = new JLabel(text);
|
||||
label.setBorder(new EmptyBorder(1, 2, 1, 0));
|
||||
return label;
|
||||
public void addServer(String name) {
|
||||
JPanel panel = new JPanel();
|
||||
this.serversPane.addTab(name, null, panel, null);
|
||||
SpringLayout sl_panel_3 = new SpringLayout();
|
||||
panel.setLayout(sl_panel_3);
|
||||
|
||||
JLabel lblServerType = new JLabel("Server type");
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, lblServerType, 10, SpringLayout.NORTH, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.WEST, lblServerType, 10, SpringLayout.WEST, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerType, 30, SpringLayout.NORTH, panel);
|
||||
panel.add(lblServerType);
|
||||
|
||||
JComboBox comboBox_3 = new JComboBox();
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_3, 10, SpringLayout.NORTH, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_3, 16, SpringLayout.EAST, lblServerType);
|
||||
panel.add(comboBox_3);
|
||||
|
||||
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);
|
||||
|
||||
JComboBox comboBox_4 = new JComboBox();
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_4, 6, SpringLayout.SOUTH, comboBox_3);
|
||||
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_4, 0, SpringLayout.WEST, comboBox_3);
|
||||
panel.add(comboBox_4);
|
||||
|
||||
JLabel lblMaxRam = new JLabel("Max ram");
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, comboBox_3, -13, SpringLayout.WEST, lblMaxRam);
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, lblMaxRam, 10, SpringLayout.NORTH, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.SOUTH, lblMaxRam, -92, SpringLayout.SOUTH, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, lblMaxRam, -111, SpringLayout.EAST, panel);
|
||||
panel.add(lblMaxRam);
|
||||
|
||||
JComboBox comboBox_5 = new JComboBox();
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, comboBox_5, 10, SpringLayout.NORTH, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.WEST, comboBox_5, 6, SpringLayout.EAST, lblMaxRam);
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, comboBox_5, 86, SpringLayout.EAST, lblMaxRam);
|
||||
panel.add(comboBox_5);
|
||||
|
||||
JCheckBox chckbxEnabled = new JCheckBox("Enabled");
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, chckbxEnabled, 6, SpringLayout.SOUTH, lblServerVersion);
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, chckbxEnabled, 0, SpringLayout.EAST, lblServerType);
|
||||
panel.add(chckbxEnabled);
|
||||
|
||||
JButton 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, comboBox_5, -5, SpringLayout.NORTH, btnRemoveServer);
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, comboBox_4, -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, comboBox_5);
|
||||
panel.add(btnRemoveServer);
|
||||
|
||||
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);
|
||||
panel.add(lblDirectory);
|
||||
|
||||
JTextField textField_1 = new JTextField();
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, textField_1, 4, SpringLayout.SOUTH, btnRemoveServer);
|
||||
sl_panel_3.putConstraint(SpringLayout.SOUTH, textField_1, -37, SpringLayout.SOUTH, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, lblDirectory, -6, SpringLayout.WEST, textField_1);
|
||||
sl_panel_3.putConstraint(SpringLayout.WEST, textField_1, 130, SpringLayout.WEST, panel);
|
||||
panel.add(textField_1);
|
||||
textField_1.setColumns(10);
|
||||
|
||||
JButton btnBrowse = new JButton("Browse");
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, textField_1, -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, comboBox_5);
|
||||
panel.add(btnBrowse);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user