Transférer les fichiers vers 'src/Test'

This commit is contained in:
Romain BESSON 2022-12-01 20:41:29 +01:00
parent 0f1b718bc8
commit 4b11806f28

View File

@ -59,11 +59,16 @@ public class MainMenu extends JFrame {
JMenu menu = new JMenu("Menu"), file = new JMenu("File"), edit = new JMenu("Edit"), view = new JMenu("View");
JMenuItem adminMenuItem = new JMenuItem("Admin View");
adminMenuItem.addActionListener((event) -> changeView(1));
JMenuItem profMenuItem = new JMenuItem("Professor View");
profMenuItem.addActionListener((event) -> changeView(2));
JMenuItem studentMenuItem = new JMenuItem("Student View");
studentMenuItem.addActionListener((event) -> changeView(3));
JMenuItem quitMenuItem = new JMenuItem("Quit");
quitMenuItem.addActionListener(this::quit);
quitMenuItem.addActionListener((event) -> System.exit(0));
menu.add(adminMenuItem);
menu.add(profMenuItem);
@ -97,6 +102,28 @@ public class MainMenu extends JFrame {
}
private void changeView(int index) {
if (index == 1) {
cardIndex = index;
cards.first(this.getContentPane());
cards.next(this.getContentPane());
adminPanel.add(cardWithTable(adminView()));
adminCards.next(adminPanel);
} else if (index == 2) {
cardIndex = index;
cards.first(this.getContentPane());
cards.next(this.getContentPane());
cards.next(this.getContentPane());
profPanel.add(cardWithTable(profView()));
profCards.next(profPanel);
} else if (index == 3){
JOptionPane.showMessageDialog(null, "En travaux");
}
}
public void updateTable(JTable table) {
if (cardIndex == 1) {
this.table = table;
@ -174,9 +201,4 @@ public class MainMenu extends JFrame {
//cardIndex = 3;
}
}
private void quit(ActionEvent e) {
System.exit(0);
}
}