-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputController.java
More file actions
64 lines (55 loc) · 1.73 KB
/
InputController.java
File metadata and controls
64 lines (55 loc) · 1.73 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
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
// Frame Switch Controller Class --> Used to implement mouse events
//For all buttons on interface, add button.addMouseListener(new FrameSwitchController(button))
// Buttons must have their background preset to yellow and font color set to black
/* For all buttons, make sure you have the following properties set
* button.setPreferredSize(new Dimension(300,100));
button.setFont(UIMethods.deriveFont("leaguespartan-bold.ttf",(Choose font size)));
button.setOpaque(true);
button.setBackground(new Color(241,248,108));
button.setBorderPainted(false);
button.addMouseListener(new FrameSwitchController(button));
button.setFocusPainted(false);
*
*
*
*
* */
public class InputController implements MouseListener
{
private JTextField userName;
private JTextField password;
public InputController(JTextField user, JTextField pass)
{
this.userName = user;
this.password = pass;
}
public void mouseEntered(MouseEvent e)
{
}
public void mouseExited(MouseEvent e)
{
}
public void mouseReleased(MouseEvent e)
{
}
public void mousePressed(MouseEvent e)
{
}
public void mouseClicked(MouseEvent e)
{
if (userName.getText().equals("Enter Username") || userName.getText().equals("Enter Password"))
{
userName.setText("");
password.setText("");
}
else if(userName.getText().equals("Login Failed")||userName.getText().equals("Account Corrupted.Please contact teacher"))
{
userName.setText("");
userName.setFont(userName.getFont().deriveFont(50.0f));
userName.setForeground(Color.BLACK);
}
}
}