import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class CheckApp extends Applet implements ItemListener
{
Checkbox cb;
Label lb1;
public void init()
{
setSize(250,250);
setLayout(new GridLayout(3,1));
cb=new Checkbox("Check It");
lb1=new Label("Can't Say");
add(this.cb);
add(this.lb1);
cb.addItemListener(this);
}
public void start()
{}
public void itemStateChanged(ItemEvent ae)
{
boolean b=cb.getState();
if(b==true)
{
lb1.setText("Checked");
add(lb1);
}
else
lb1.setText("Unchecked");
}
}
No comments:
Post a Comment