Transférer les fichiers vers 'src/Test' #1
@ -15,11 +15,12 @@ public class MainMenu extends JFrame {
|
||||
private StudentView sv;
|
||||
private JTable table;
|
||||
private int cardIndex = 0;
|
||||
private String[] viewName = {"Administrateur", "Professeur", "Etudiant"}
|
||||
|
||||
private final JButton[] buttonTab = {
|
||||
new JButton("Admin"),
|
||||
new JButton("Prof"),
|
||||
new JButton("Student")
|
||||
new JButton(viewName[0]),
|
||||
new JButton(viewName[1]),
|
||||
new JButton(viewName[2])
|
||||
};
|
||||
|
||||
|
||||
@ -56,16 +57,16 @@ public class MainMenu extends JFrame {
|
||||
private void createJMenuBar() {
|
||||
JMenu menu = new JMenu("Menu"), file = new JMenu("File"), edit = new JMenu("Edit"), view = new JMenu("View");
|
||||
|
||||
JMenuItem adminMenuItem = new JMenuItem("Admin View");
|
||||
JMenuItem adminMenuItem = new JMenuItem("Vu "+viewName[0]);
|
||||
adminMenuItem.addActionListener((event) -> changeView(1));
|
||||
|
||||
JMenuItem profMenuItem = new JMenuItem("Professor View");
|
||||
JMenuItem profMenuItem = new JMenuItem("Vu "+viewName[0]);
|
||||
profMenuItem.addActionListener((event) -> changeView(2));
|
||||
|
||||
JMenuItem studentMenuItem = new JMenuItem("Student View");
|
||||
JMenuItem studentMenuItem = new JMenuItem("Vu "+viewName[0]);
|
||||
studentMenuItem.addActionListener((event) -> changeView(3));
|
||||
|
||||
JMenuItem quitMenuItem = new JMenuItem("Quit");
|
||||
JMenuItem quitMenuItem = new JMenuItem("Quitter");
|
||||
quitMenuItem.addActionListener((event) -> System.exit(0));
|
||||
|
||||
menu.add(adminMenuItem);
|
||||
@ -106,7 +107,7 @@ public class MainMenu extends JFrame {
|
||||
|
||||
if (index == 1) {
|
||||
cardIndex = index;
|
||||
this.setTitle("Administrator");
|
||||
this.setTitle(viewName[0]);
|
||||
adminPanel.setLayout(adminCards);
|
||||
adminPanel.add(cardWithTable(adminView()));
|
||||
adminCards.next(adminPanel);
|
||||
@ -114,7 +115,7 @@ public class MainMenu extends JFrame {
|
||||
|
||||
} else if (index == 2) {
|
||||
cardIndex = index;
|
||||
this.setTitle("Professor");
|
||||
this.setTitle(viewName[1]);
|
||||
profPanel.setLayout(profCards);
|
||||
profPanel.add(cardWithTable(profView()));
|
||||
profCards.next(profPanel);
|
||||
@ -122,7 +123,7 @@ public class MainMenu extends JFrame {
|
||||
|
||||
} else if (index == 3){
|
||||
cardIndex = index;
|
||||
this.setTitle("Student");
|
||||
this.setTitle(viewName[2]);
|
||||
studentPanel.setLayout(studentCards);
|
||||
studentPanel.add(cardWithTable(studentView()));
|
||||
studentCards.next(studentPanel);
|
||||
@ -204,21 +205,21 @@ public class MainMenu extends JFrame {
|
||||
createJMenuBar();
|
||||
|
||||
if (origin.getText().equals("Admin")) {
|
||||
this.setTitle("Administrator");
|
||||
this.setTitle(viewName[0]);
|
||||
menuBar.setBackground(Color.RED);
|
||||
adminPanel.setLayout(adminCards);
|
||||
adminPanel.add(cardWithTable(adminView()));
|
||||
cardIndex = 1;
|
||||
|
||||
} else if (origin.getText().equals("Prof")) {
|
||||
this.setTitle("Professor");
|
||||
this.setTitle(viewName[1]);
|
||||
menuBar.setBackground(Color.MAGENTA);
|
||||
profPanel.setLayout(profCards);
|
||||
profPanel.add(cardWithTable(profView()));
|
||||
cardIndex = 2;
|
||||
|
||||
} else {
|
||||
this.setTitle("Student");
|
||||
this.setTitle(viewName[2]);
|
||||
menuBar.setBackground(Color.BLUE);
|
||||
studentPanel.setLayout(studentCards);
|
||||
studentPanel.add(cardWithTable(studentView()));
|
||||
|
Loading…
Reference in New Issue
Block a user