package GuIBasedProgram;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Boxes extends Applet implements ActionListener {
Button b1;
Checkbox name1;
Checkbox name2;
public void init()
{
name1=new Checkbox("Red",null,false);
name2=new Checkbox("Blue",null,false);
b1=new Button("Submit");
add(name1);
add(name2);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();
if(str.equals("Submit"))
{
repaint();
}
}
public void paint(Graphics g)
{
if(name1.getState())
{
g.drawString("Red", 50, 60);
}
if(name2.getState())
{
g.drawString("Blue", 50, 80);
}
}
}
|
1 comment:
I have to agree with everything in this post. Thanks for the useful information.
Struts Training in Chennai
Struts Training
Wordpress Training in Chennai
Wordpress Training
Wordpress Training in Velachery
Wordpress Training in Tambaram
Struts Training
Struts Training in Chennai
Post a Comment