-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventdm.java
46 lines (37 loc) · 1.11 KB
/
Eventdm.java
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.*;
import java.awt.event.*;
class Eventdm
{
Frame f1=new Frame();
Button b1=new Button("click");
Button b2=new Button("delete");
TextField tf1=new TextField(40);
Eventdm()
{
f1.setLayout(new FlowLayout());
f1.add(b1);
f1.add(b2);
f1.add(tf1);
A a=new A(tf1);
b1.addActionListener(a);
b2.addActionListener(a);
f1.setSize(450,450);
f1.setVisible(true);
}
public static void main(String args[])
{
Eventdm e=new Eventdm();
}
class A implements ActionListener
{
TextField tf1;
A (TextField tf1)
{
this.tf1=tf1;
}
public void actionPerformed(ActionEvent ae)
{
tf1.setText("welcome");
}
}
}