public static void main (String[] args)
{
Menu frame = new Menu();
try
{
Image img = ImageIO.read(Menu.class.getResource("re_icon.jpg"));
frame.setIconImage(img);
}
catch (IOException e)
{
e.printStackTrace();
}
frame.setLocation(100, 100);
frame.setSize(700, 500);
JPanel rightPanel = new JPanel();
TitledBorder titledBorder = BorderFactory.createTitledBorder("BorderTitle");
rightPanel.setBorder(titledBorder);
GridBagLayout gbl = new GridBagLayout();
rightPanel.setLayout(gbl);
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.VERTICAL;
gbc.insets = new Insets(5, 5, 5, 5);
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.WEST;
JLabel parkNameLabel = new JLabel("Parkname:");
gbl.setConstraints(parkNameLabel, gbc);
rightPanel.add(parkNameLabel);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridheight = 1;
JTextField parkName = new JTextField(20);
gbl.setConstraints(parkName, gbc);
rightPanel.add(parkName);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.WEST;
JLabel facilityTypeLabel = new JLabel("Anlagentyp:");
gbl.setConstraints(facilityTypeLabel, gbc);
rightPanel.add(facilityTypeLabel);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.gridheight = 1;
String[] facilityTypes = {"WEA", "GS", "MS"};
JComboBox comboBoxFacilityTypes = new JComboBox();
for (String string : facilityTypes)
comboBoxFacilityTypes.addItem(string);
gbl.setConstraints(comboBoxFacilityTypes, gbc);
rightPanel.add(comboBoxFacilityTypes);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.WEST;
JLabel facilityNumberLabel = new JLabel("Anlagennummer:");
gbl.setConstraints(facilityNumberLabel, gbc);
rightPanel.add(facilityNumberLabel);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridheight = 1;
JTextField facilityNumber = new JTextField(20);
gbl.setConstraints(facilityNumber, gbc);
rightPanel.add(facilityNumber);
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.WEST;
JLabel typeLabel = new JLabel("Typ:");
gbl.setConstraints(typeLabel, gbc);
rightPanel.add(typeLabel);
gbc.gridx = 1;
gbc.gridy = 3;
gbc.gridheight = 1;
String[] types = {"MD77", "MM82", "MM92"};
JComboBox comboBoxTypes = new JComboBox();
for (String string : types)
comboBoxTypes.addItem(string);
gbl.setConstraints(comboBoxTypes, gbc);
rightPanel.add(comboBoxTypes);
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.WEST;
JLabel serialNumberLabel = new JLabel("Seriennummer:");
gbl.setConstraints(serialNumberLabel, gbc);
rightPanel.add(serialNumberLabel);
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridheight = 1;
JTextField serialNumber = new JTextField(20);
gbl.setConstraints(serialNumber, gbc);
rightPanel.add(serialNumber);
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridheight = 1;
gbc.anchor = GridBagConstraints.WEST;
JLabel ipAddressLabel = new JLabel("IP-Adresse:");
gbl.setConstraints(ipAddressLabel, gbc);
rightPanel.add(ipAddressLabel);
gbc.gridx = 1;
gbc.gridy = 5;
gbc.gridheight = 1;
JTextField ipAddress = new JTextField(20);
gbl.setConstraints(ipAddress, gbc);
rightPanel.add(ipAddress);
JScrollPane leftScrollPane = new JScrollPane();
leftScrollPane.setMinimumSize(new Dimension(0, 0));
leftScrollPane.setPreferredSize(new Dimension(200, 500));
JScrollPane rightScrollPane = new JScrollPane();
rightScrollPane.setMinimumSize(new Dimension(0, 0));
rightScrollPane.setViewportView(rightPanel);
JTree tree = new JTree();
leftScrollPane.setViewportView(tree);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setLeftComponent(leftScrollPane);
splitPane.setRightComponent(rightScrollPane);
frame.getContentPane().add(splitPane);
frame.setVisible(true);
}