-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClearController.java
More file actions
46 lines (35 loc) · 858 Bytes
/
ClearController.java
File metadata and controls
46 lines (35 loc) · 858 Bytes
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
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class ClearController implements MouseListener
{
private JTextField input;
private String textToClear;
private TypingViewTemplate view;
public ClearController(TypingViewTemplate tv,JTextField inputField, String defaultText)
{
this.input= inputField;
this.textToClear = defaultText;
this.view = tv;
}
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(this.input.getText().equals(this.textToClear))
{
this.input.setText("");
this.view.startSession();
}
}
}