package fahrzeuge;
import java.awt.Color;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
public class Start extends JFrame {
public static void main(String[] args) {
new Start();
}
public Start() {
super();
initialize();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
private void initialize() {
this.setSize(330, 400);
this.getContentPane().add(getJContentPane());
this.setTitle("Fahrzeuggeräte");
}
private JScrollPane getJContentPane() {
JScrollPane scpPanel = null;
if (scpPanel == null) {
JPanel panel = new JPanel();
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
panel.setLayout(gb);
panel.setBackground(Color.WHITE);
int anzahl_gesamt_bgt = 5;
ButtonGroup group = new ButtonGroup();
final JCheckBox cb_bgt[] = new JCheckBox[anzahl_gesamt_bgt];
cb_bgt[0] = new JCheckBox(
"<html>Fahrzeuggerät, komplett<br>BR 189 (LZB80E)</html>");
cb_bgt[1] = new JCheckBox(
"<html>Zentraleinheit, komplett<br>für TFZ, BR423 LZB 80/16</html>");
cb_bgt[2] = new JCheckBox(
"<html>Fahrzeuggerät, komplett<br>M21 A-Wagen</html>");
cb_bgt[3] = new JCheckBox(
"<html>Fahrzeuggerät, komplett<br>M21 B-Wagen</html>");
cb_bgt[4] = new JCheckBox(
"<html>Fahrzeuggerät, komplett<br>M21 C-Wagen</html>");
int j = 1;
for (int i = 0; i < 5; i++) {
group.add(cb_bgt[i]);
gbc.gridx = 1;
gbc.gridy = j;
gbc.gridwidth = 6;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 1;
gbc.weighty = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 10, 0, 0);
gb.setConstraints(cb_bgt[i], gbc);
cb_bgt[i].setBackground(Color.WHITE);
panel.add(cb_bgt[i]);
j++;
}
//ImageIcon bild = new ImageIcon("images/Alcatel_logo.jpg");
//ImageIcon bild = new ImageIcon(ClassLoader.getSystemResource("images/Alcatel_logo.jpg"));
ImageIcon bild = new ImageIcon(ClassLoader.getSystemResource("images/Alcatel_logo.jpg"));
JLabel lab_bild = new JLabel(bild);
gbc.gridx = 7;
gbc.gridy = 1;
gbc.gridwidth = 6;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 1;
gbc.weighty = 0;
gbc.anchor = GridBagConstraints.CENTER;
gb.setConstraints(lab_bild, gbc);
panel.add(lab_bild);
JButton Starten = new JButton("Starten");
gbc.gridx = 7;
gbc.gridy = j - 2;
gbc.gridwidth = 6;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 1;
gbc.weighty = 0;
gbc.anchor = GridBagConstraints.CENTER;
gb.setConstraints(Starten, gbc);
panel.add(Starten);
JButton Beenden = new JButton("Beenden");
gbc.gridx = 7;
gbc.gridy = j - 1;
gbc.gridwidth = 6;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 1;
gbc.weighty = 0;
gbc.anchor = GridBagConstraints.CENTER;
gb.setConstraints(Beenden, gbc);
panel.add(Beenden);
Starten.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Frame af[] = { new LZB80E(), new LZB8016(), new M21A(),
new M21B(), new M21C() };
for (int i = 0; i < af.length; i++) {
af[i].setVisible(cb_bgt[i].isSelected());
}
}
});
Beenden.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
scpPanel = new JScrollPane(panel);
}
return scpPanel;
}
}