-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeacherDashboardView1.java
More file actions
95 lines (80 loc) · 3.08 KB
/
TeacherDashboardView1.java
File metadata and controls
95 lines (80 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* TeacherDashboardView1
* Created by: Johnson Duong
* Updated on: 2019/05/29
* The home screen of the Teacher Dashboard
*/
import javax.swing.*;
import java.awt.*;
public class TeacherDashboardView1 extends WallPaperPanel
{
//instance variables
private JFrame window;
private FrameModel model;
private JPanel componentsPanel = new JPanel(new GridBagLayout());
private JLabel welcomeText = new JLabel("Welcome,");
private JLabel nameText = new JLabel();
private CustomButton classListButton = new CustomButton("Class List", 346, 70, 32);
private CustomButton changePasswordButton = new CustomButton("Change Password", 346, 70, 32);
private CustomButton logoutButton = new CustomButton("Logout", 346, 70, 32);
private GridBagConstraints gbc = new GridBagConstraints();
private Teacher loggedIn;
//constructor
public TeacherDashboardView1(FrameModel model, JFrame frame, Teacher user)
{
super();
this.window = frame;
this.model = model;
this.loggedIn=user;
this.layoutView();
this.registerControllers();
this.update();
}//end constructor
//set the initial layout of the window
private void layoutView()
{
//the welcome text
welcomeText.setFont(UIMethods.deriveFont("leaguespartan-bold.ttf", 48f));
nameText.setFont(UIMethods.deriveFont("leaguespartan-bold.ttf", 48f));
nameText.setText(this.loggedIn.getTeacherUsername());
this.gbc.insets = new Insets(160,0,20,0);
this.gbc.gridx = 0;
this.gbc.gridy = 0;
componentsPanel.add(welcomeText,gbc);
this.gbc.insets = new Insets(0,0,20,0);
this.gbc.gridx = 0;
this.gbc.gridy = 1;
componentsPanel.add(nameText, gbc);
//the buttons
this.gbc.insets = new Insets(0,0,10,0);
this.gbc.gridx = 0;
this.gbc.gridy = 2;
componentsPanel.add(classListButton, gbc);
this.gbc.gridx = 0;
this.gbc.gridy = 3;
componentsPanel.add(changePasswordButton, gbc);
this.gbc.gridx = 0;
this.gbc.gridy = 4;
componentsPanel.add(logoutButton, gbc);
//the window
componentsPanel.setOpaque(false);
this.add(componentsPanel);
window.setContentPane(this);
window.setTitle("Learning Mode");
window.setSize(1366, 768);
window.setVisible(true);
}//end layoutView
//registering the controllers
private void registerControllers()
{
FrameSwitchController classListController = new FrameSwitchController(this.classListButton,this.model,"TeacherDashboard3");
this.classListButton.addMouseListener(classListController);
FrameSwitchController changePasswordController = new FrameSwitchController(this.changePasswordButton,this.model,"TeacherDashboard2");
this.changePasswordButton.addMouseListener(changePasswordController);
FrameSwitchController logoutController = new FrameSwitchController(this.logoutButton,this.model,"Logout");
this.logoutButton.addMouseListener(logoutController);
}//end registerControllers
//updates the view
private void update()
{
}//end update
}//ssalc