-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextFieldAndTextEvent.java
More file actions
42 lines (35 loc) · 934 Bytes
/
textFieldAndTextEvent.java
File metadata and controls
42 lines (35 loc) · 934 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
import java.awt.*;
import java.awt.event.*;
class myframe extends Frame implements ActionListener,TextListener
{
Label l1,l2;
TextField tf;
public myframe()
{
super("poject");
tf = new TextField(20);
tf.setEchoChar('*');
l1 =new Label("nothing is added yet");
l2 = new Label("enter is not yet hit");
tf.addTextListener(this);
tf.addActionListener(this);
setLayout(new FlowLayout());
add(tf);
add(l1);
add(l2);
}
public void textValueChanged(TextEvent e) {
l1.setText(tf.getText());
}
public void actionPerformed(ActionEvent e) {
l2.setText(tf.getText());
}
}
public class textFieldAndTextEvent {
public static void main(String arg[])
{
myframe f =new myframe();
f.setSize(500,500);
f.setVisible(true);
}
}