Transférer les fichiers vers 'src/Test'

This commit is contained in:
Romain BESSON 2022-12-04 00:54:14 +01:00
parent 5d504e386c
commit c9fb5669f0

View File

@ -46,8 +46,8 @@ public class MainMenu extends JFrame {
this.setMinimumSize(MINIMUM_SIZE);
init(listener);
changeView(selectedView);
setScreenStyle(screenStyle);
initView(selectedView);
this.setVisible(true);
@ -61,6 +61,7 @@ public class MainMenu extends JFrame {
} else if (screenStyle == WINDOW) {
this.setUndecorated(false);
this.screenStatus = WINDOW;
}
}
@ -132,14 +133,18 @@ public class MainMenu extends JFrame {
private void setFullScreen(ActionEvent e) {
this.dispose();
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, FULL));
if (screenStatus != FULL) {
this.dispose();
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, FULL));
}
}
private void unsetFullScreen(ActionEvent e) {
this.dispose();
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, WINDOW));
if (screenStatus != WINDOW) {
this.dispose();
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, WINDOW));
}
}
@ -179,35 +184,35 @@ public class MainMenu extends JFrame {
private void changeView(int index) {
table = this.listener.initTable();
System.out.println("change view");
if (index == 1) {
this.cardIndex = index;
this.currentView = ADMIN;
this.setTitle(this.viewName[0]);
this.adminPanel.setLayout(this.adminCards);
this.adminPanel.add(cardWithTable(adminView(), viewName[0]));
this.adminCards.next(this.adminPanel);
this.menuBar.setBackground(this.adminColor);
System.out.println("Admin view");
} else if (index == 2) {
this.cardIndex = index;
this.currentView = PROF;
this.setTitle(this.viewName[1]);
this.profPanel.setLayout(this.profCards);
this.profPanel.add(cardWithTable(profView(), viewName[1]));
this.profCards.next(this.profPanel);
this.menuBar.setBackground(this.profColor);
System.out.println("prof view");
} else if (index == 3){
this.cardIndex = index;
this.currentView = STUDENT;
this.setTitle(this.viewName[2]);
this.studentPanel.setLayout(this.studentCards);
this.studentPanel.add(cardWithTable(studentView(), viewName[2]));
this.studentCards.next(this.studentPanel);
this.menuBar.setBackground(this.studentColor);
System.out.println("student view");
}
travelThroughCards(index);
}
@ -282,6 +287,17 @@ public class MainMenu extends JFrame {
private void action(ActionEvent e) {
JButton origin = (JButton) e.getSource();
if (origin.getText().equals(viewName[0])) {
initView(ADMIN);
} else if (origin.getText().equals(viewName[1])) {
initView(PROF);
} else {
initView(STUDENT);
}
}
private void initView(int index) {
if (menuBar == null) {
menuBar = new JMenuBar();
createJMenuBar();
@ -289,16 +305,18 @@ public class MainMenu extends JFrame {
this.setJMenuBar(menuBar);
}
if (origin.getText().equals(viewName[0])) {
if (index == ADMIN) {
this.setTitle(viewName[0]);
this.currentView = ADMIN;
menuBar.setBackground(this.adminColor);
adminPanel.setLayout(adminCards);
adminPanel.add(cardWithTable(adminView(), viewName[0]));
adminCards.next(adminPanel);
cardIndex = 1;
} else if (origin.getText().equals(viewName[1])) {
} else if (index == PROF) {
this.setTitle(viewName[1]);
this.currentView = PROF;
menuBar.setBackground(this.profColor);
profPanel.setLayout(profCards);
profPanel.add(cardWithTable(profView(), viewName[1]));
@ -307,6 +325,7 @@ public class MainMenu extends JFrame {
} else {
this.setTitle(viewName[2]);
this.currentView = STUDENT;
menuBar.setBackground(this.studentColor);
studentPanel.setLayout(studentCards);
studentPanel.add(cardWithTable(studentView(), viewName[2]));