-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCheckBoxDemo.java
More file actions
38 lines (37 loc) · 871 Bytes
/
Copy pathCheckBoxDemo.java
File metadata and controls
38 lines (37 loc) · 871 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.awt.event.*;
import java.applet.*;
/*<applet code = CheckBoxDemo width = 300 height = 300 > </applet>*/
public class CheckBoxDemo extends Applet implements ItemListener
{
Checkbox a,b,c;
String msg = " ";
public void init()
{
setLayout(new FlowLayout());
a = new Checkbox("M.Tech");
b = new Checkbox("B.Tech");
c = new Checkbox("Ph.D");
add(b);
add(a);
add(c);
a.addItemListener(this);
b.addItemListener(this);
c.addItemListener(this);
}
public void itemStateChanged(ItemEvent i)
{
repaint();
}
public void paint(Graphics g)
{
msg = "Current Qualification";
g.drawString(msg,10,40);
msg = "B.Tech "+ b.getState();
g.drawString(msg,10,50);
msg = "M.Tech "+ a.getState();
g.drawString(msg,10,70);
msg = "ph.D "+ c.getState();
g.drawString(msg,10,90);
}
}