-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardLayoutDemo.java
More file actions
49 lines (48 loc) · 1.16 KB
/
CardLayoutDemo.java
File metadata and controls
49 lines (48 loc) · 1.16 KB
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
47
48
49
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class CardLayoutDemo extends Applet implements ActionListener
{
CardLayout cardlo;
Panel OScard;
Button bwin,bother;
Checkbox win98,winXP,linux,mac;
public void init()
{
cardlo=new CardLayout();
OScard=new Panel();
OScard.setLayout(cardlo);
bwin=new Button("Windows");
bother=new Button("Other");
add(bwin);
add(bother);
win98=new Checkbox("Windows 98",true);
winXP=new Checkbox("Windows XP");
Panel winpan=new Panel();
winpan.add(win98);
winpan.add(winXP);
linux=new Checkbox("Linux");
mac=new Checkbox("Mac");
Panel otherpan=new Panel();
otherpan.add(linux);
otherpan.add(mac);
OScard.add(winpan,"Windows");
OScard.add(otherpan,"Other");
add(OScard);
bwin.addActionListener(this);
bother.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==bwin)
{
cardlo.show(OScard,"Windows");
showStatus("Welcome to windows Operating System");
}
else if(e.getSource()==bother)
{
cardlo.show(OScard,"Other");
showStatus("Welcome to Other Operating System");
}
}
}