Transférer les fichiers vers 'src/Test'

This commit is contained in:
Romain BESSON 2022-12-04 00:33:53 +01:00
parent 834baf4081
commit 5d504e386c
2 changed files with 39 additions and 8 deletions

View File

@ -677,4 +677,6 @@ public class Controller implements ActionListener, ListSelectionListener {
public ArrayList<Groupe> getGroupes() {
return this.g;
}
public void setMainMenu(MainMenu m) {this.parent = m;}
}

View File

@ -5,12 +5,16 @@ import java.awt.*;
import java.awt.event.ActionEvent;
public class MainMenu extends JFrame {
public static final int MENU = 0, ADMIN = 1, PROF = 2, STUDENT = 3;
private static final int FULL = 4, WINDOW = 5;
private final static Dimension MINIMUM_SIZE = new Dimension(960, 600);
private final CardLayout cards = new CardLayout(), adminCards = new CardLayout(), profCards = new CardLayout(), studentCards = new CardLayout();
private final JPanel adminPanel = new JPanel(), profPanel = new JPanel(), studentPanel = new JPanel();
private final Color adminColor = new Color(255, 2, 2);
private final Color profColor = new Color(182, 2, 189);
private final Color studentColor = new Color(53, 242, 242);
private int screenStatus = WINDOW;
private int currentView = MENU;
private JMenuBar menuBar;
private Controller listener;
private AdminView av;
@ -35,6 +39,31 @@ public class MainMenu extends JFrame {
this.setVisible(true);
}
public MainMenu(Controller listener, int selectedView, int screenStyle) {
super();
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setExtendedState(MAXIMIZED_BOTH);
this.setMinimumSize(MINIMUM_SIZE);
init(listener);
changeView(selectedView);
setScreenStyle(screenStyle);
this.setVisible(true);
}
private void setScreenStyle(int screenStyle) {
if (screenStyle == FULL) {
this.setUndecorated(true);
this.screenStatus = FULL;
} else if (screenStyle == WINDOW) {
this.setUndecorated(false);
}
}
private void init(Controller listener) {
this.listener = listener;
@ -103,18 +132,14 @@ public class MainMenu extends JFrame {
private void setFullScreen(ActionEvent e) {
this.setVisible(false);
this.setExtendedState(MAXIMIZED_BOTH);
this.setUndecorated(true);
this.setVisible(true);
this.dispose();
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, FULL));
}
private void unsetFullScreen(ActionEvent e) {
this.setVisible(false);
this.setSize(MINIMUM_SIZE);
this.setUndecorated(false);
this.setVisible(true);
this.dispose();
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, WINDOW));
}
@ -154,6 +179,7 @@ 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;
@ -162,6 +188,7 @@ public class MainMenu extends JFrame {
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;
@ -170,6 +197,7 @@ public class MainMenu extends JFrame {
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;
@ -178,6 +206,7 @@ public class MainMenu extends JFrame {
this.studentPanel.add(cardWithTable(studentView(), viewName[2]));
this.studentCards.next(this.studentPanel);
this.menuBar.setBackground(this.studentColor);
System.out.println("student view");
}
travelThroughCards(index);
}