-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonStatus.java
More file actions
38 lines (36 loc) · 840 Bytes
/
ButtonStatus.java
File metadata and controls
38 lines (36 loc) · 840 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
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class ButtonStatus extends Applet
{
Label lb1 = new Label("BUTTON 1");
Button b1 = new Button("OK");
Label lb2 = new Label("BUTTON ");
Button b2 = new Button("CANCEL");
public void init()
{
setLayout(new GridLayout(2,2));
b1.addActionListener(new b1());
b2.addActionListener(new b2());
add(lb1);
add(b1);
add(lb2);
add(b2);
}
class b1 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
getAppletContext().showStatus("Button1 : clicked ok");
setBackground(Color.red);
}
}
class b2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
getAppletContext().showStatus("Button2 : clicked cancle");
setBackground(Color.blue);
}
}
}