-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui10.java
More file actions
41 lines (41 loc) · 755 Bytes
/
Copy pathgui10.java
File metadata and controls
41 lines (41 loc) · 755 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
import java.awt.*;
import java.awt.event.*;
class gui10 implements ActionListener
{
//Label l1;
TextField tf,tf1;
Button b;
public gui10()
{
Frame f=new Frame();
f.setSize(300,300);
f.setLayout(new FlowLayout());
Label l=new Label("Name");
tf=new TextField(20);
b=new Button("click here");
tf1=new TextField(30);
b.addActionListener(this);
f.add(l);
f.add(tf);
f.add(b);
f.add(tf1);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
f.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String nam=tf.getText();
if(e.getSource()==b)
tf1.setText("hello "+nam);
}
public static void main(String args[])
{
new gui10();
}
}