99 CheckBox and Radio Buttons in awt in Java

Code :

import java.awt.*;
class NewLogin
{
public static void main(String args[])
{
Frame f = new Frame();
f.setVisible  (true);
f.setSize(300,300);
f.setBackground(Color.green);
f.setLayout( new FlowLayout() );
f.setTitle("My Frame");

Label l1 = new Label("Qualification: ");
Label l2 = new Label("Gender: ");

Checkbox cb1 = new Checkbox("10th",true);
Checkbox cb2 = new Checkbox("12th");
Checkbox cb3 = new Checkbox("BE");
Checkbox cb4 = new Checkbox("ME");
System.out.println(cb1.getLabel());

CheckboxGroup cg = new CheckboxGroup();
Checkbox c1 = new Checkbox("male",cg,true);
Checkbox c2 = new Checkbox("female",cg,false);
System.out.println(c1.getLabel());

f.add(l1);
f.add(cb1);
f.add(cb2);
f.add(cb3);
f.add(cb4);

f.add(l2);
f.add(c1);
f.add(c2);
}
}




Output:



Previous
Next Post »