3 import java.awt.BorderLayout;
4 import java.awt.Container;
5 import java.rmi.RemoteException;
7 import javax.swing.BoxLayout;
8 import javax.swing.JComboBox;
9 import javax.swing.JFrame;
10 import javax.swing.JLabel;
11 import javax.swing.JOptionPane;
12 import javax.swing.JPanel;
16 import controller.ClientInterfaceImpl;
17 import controller.Controller;
25 @SuppressWarnings(
"serial")
27 private JComboBox selectionComboBox = null;
33 super(controller,
"Login-Fenster");
39 JPanel selectionPanel =
new JPanel();
41 .setLayout(
new BoxLayout(selectionPanel, BoxLayout.Y_AXIS));
42 JLabel selectionLabel =
new JLabel(
43 "Mit welcher Rolle möchten Sie sich anmelden?");
44 selectionComboBox =
new JComboBox();
45 for (Object sta :
UserRole.values()) {
46 selectionComboBox.addItem(sta.toString());
49 selectionPanel.add(selectionLabel);
50 selectionPanel.add(selectionComboBox);
55 if (JOptionPane.showConfirmDialog(null, selectionPanel,
56 "Rollenauswahl", JOptionPane.OK_CANCEL_OPTION,
57 JOptionPane.PLAIN_MESSAGE) == 0) {
59 if (selectionComboBox.getSelectedItem().toString()
76 private void login(
UserRole role)
throws RemoteException {
87 AbstractFrame viewMF = null;
93 viewMF = controller.getFrame(
MainFrame.class);
100 if (viewMF == null) {
101 viewMF =
new MainFrame(controller, role);
106 controller.addObserver(viewMF);
111 controller.addFrame(viewMF);
114 viewMF.setSize(800, 300);
117 viewMF.setLocationRelativeTo(null);
118 viewMF.setVisible(
true);