Sunday, 27 May 2012

Check Boxes in Applet


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");
}



}

1 comment:

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete