-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangePasswordController.java
More file actions
72 lines (60 loc) · 1.79 KB
/
ChangePasswordController.java
File metadata and controls
72 lines (60 loc) · 1.79 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
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class ChangePasswordController implements MouseListener
{
private Teacher loggedInTeacher;
private Student selectedStudent;
private JTextField newPassword;
private JButton bt;
private FrameModel model;
public ChangePasswordController(JButton button, FrameModel md, JTextField passwordField, Teacher currentTeacher)
{
this.bt=button;
this.model=md;
this.loggedInTeacher=currentTeacher;
this.newPassword = passwordField;
}
public ChangePasswordController(JButton button, FrameModel md, JTextField passwordField, Student currentStudent)
{
this.bt=button;
this.model=md;
this.selectedStudent=currentStudent;
this.newPassword = passwordField;
}
public void mouseEntered(MouseEvent e)
{
bt.setOpaque(true);
bt.setForeground(new Color(241,248,108));
bt.setBorder(BorderFactory.createRaisedBevelBorder());
bt.setBackground(Color.BLACK);
}
public void mouseExited(MouseEvent e)
{
bt.setOpaque(true);
bt.setBackground(new Color(241,248,108));
bt.setBorder(BorderFactory.createRaisedBevelBorder());
bt.setForeground(Color.BLACK);
}
public void mouseReleased(MouseEvent e)
{
}
public void mousePressed(MouseEvent e)
{
}
public void mouseClicked(MouseEvent e)
{
if(this.newPassword.getText()!="" && this.loggedInTeacher!=null)
{
this.loggedInTeacher.setTeacherPassword(this.newPassword.getText());
this.newPassword.setText("Password Changed!");
this.newPassword.setForeground(Color.GREEN);
}
else if (this.newPassword.getText()!="")
{
this.selectedStudent.changePassword(this.newPassword.getText());
this.newPassword.setText("Password Changed!");
this.newPassword.setForeground(Color.GREEN);
}
}
}