Transférer les fichiers vers 'src/Test'
This commit is contained in:
parent
834baf4081
commit
5d504e386c
@ -677,4 +677,6 @@ public class Controller implements ActionListener, ListSelectionListener {
|
|||||||
public ArrayList<Groupe> getGroupes() {
|
public ArrayList<Groupe> getGroupes() {
|
||||||
return this.g;
|
return this.g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMainMenu(MainMenu m) {this.parent = m;}
|
||||||
}
|
}
|
@ -5,12 +5,16 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class MainMenu extends JFrame {
|
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 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 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 JPanel adminPanel = new JPanel(), profPanel = new JPanel(), studentPanel = new JPanel();
|
||||||
private final Color adminColor = new Color(255, 2, 2);
|
private final Color adminColor = new Color(255, 2, 2);
|
||||||
private final Color profColor = new Color(182, 2, 189);
|
private final Color profColor = new Color(182, 2, 189);
|
||||||
private final Color studentColor = new Color(53, 242, 242);
|
private final Color studentColor = new Color(53, 242, 242);
|
||||||
|
private int screenStatus = WINDOW;
|
||||||
|
private int currentView = MENU;
|
||||||
private JMenuBar menuBar;
|
private JMenuBar menuBar;
|
||||||
private Controller listener;
|
private Controller listener;
|
||||||
private AdminView av;
|
private AdminView av;
|
||||||
@ -35,6 +39,31 @@ public class MainMenu extends JFrame {
|
|||||||
this.setVisible(true);
|
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) {
|
private void init(Controller listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
@ -103,18 +132,14 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
|
|
||||||
private void setFullScreen(ActionEvent e) {
|
private void setFullScreen(ActionEvent e) {
|
||||||
this.setVisible(false);
|
this.dispose();
|
||||||
this.setExtendedState(MAXIMIZED_BOTH);
|
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, FULL));
|
||||||
this.setUndecorated(true);
|
|
||||||
this.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void unsetFullScreen(ActionEvent e) {
|
private void unsetFullScreen(ActionEvent e) {
|
||||||
this.setVisible(false);
|
this.dispose();
|
||||||
this.setSize(MINIMUM_SIZE);
|
this.listener.setMainMenu(new MainMenu(this.listener, this.currentView, WINDOW));
|
||||||
this.setUndecorated(false);
|
|
||||||
this.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -154,6 +179,7 @@ public class MainMenu extends JFrame {
|
|||||||
|
|
||||||
private void changeView(int index) {
|
private void changeView(int index) {
|
||||||
table = this.listener.initTable();
|
table = this.listener.initTable();
|
||||||
|
System.out.println("change view");
|
||||||
|
|
||||||
if (index == 1) {
|
if (index == 1) {
|
||||||
this.cardIndex = index;
|
this.cardIndex = index;
|
||||||
@ -162,6 +188,7 @@ public class MainMenu extends JFrame {
|
|||||||
this.adminPanel.add(cardWithTable(adminView(), viewName[0]));
|
this.adminPanel.add(cardWithTable(adminView(), viewName[0]));
|
||||||
this.adminCards.next(this.adminPanel);
|
this.adminCards.next(this.adminPanel);
|
||||||
this.menuBar.setBackground(this.adminColor);
|
this.menuBar.setBackground(this.adminColor);
|
||||||
|
System.out.println("Admin view");
|
||||||
|
|
||||||
} else if (index == 2) {
|
} else if (index == 2) {
|
||||||
this.cardIndex = index;
|
this.cardIndex = index;
|
||||||
@ -170,6 +197,7 @@ public class MainMenu extends JFrame {
|
|||||||
this.profPanel.add(cardWithTable(profView(), viewName[1]));
|
this.profPanel.add(cardWithTable(profView(), viewName[1]));
|
||||||
this.profCards.next(this.profPanel);
|
this.profCards.next(this.profPanel);
|
||||||
this.menuBar.setBackground(this.profColor);
|
this.menuBar.setBackground(this.profColor);
|
||||||
|
System.out.println("prof view");
|
||||||
|
|
||||||
} else if (index == 3){
|
} else if (index == 3){
|
||||||
this.cardIndex = index;
|
this.cardIndex = index;
|
||||||
@ -178,6 +206,7 @@ public class MainMenu extends JFrame {
|
|||||||
this.studentPanel.add(cardWithTable(studentView(), viewName[2]));
|
this.studentPanel.add(cardWithTable(studentView(), viewName[2]));
|
||||||
this.studentCards.next(this.studentPanel);
|
this.studentCards.next(this.studentPanel);
|
||||||
this.menuBar.setBackground(this.studentColor);
|
this.menuBar.setBackground(this.studentColor);
|
||||||
|
System.out.println("student view");
|
||||||
}
|
}
|
||||||
travelThroughCards(index);
|
travelThroughCards(index);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user