/*Program to convert checkboxes into radio buttons*/
import java.awt.*;
class elec extends Frame
{
Label l1,l2;
Checkbox a,b,c,d,e,f;
CheckboxGroup x,y;
public elec()
{
setTitle("UNIVERSITY FORM:");
l1=new Label("OPTION 1:");
l2=new Label("OPTION 2:");
x=new CheckboxGroup();
y=new CheckboxGroup();
a=new Checkbox("maths",false,x);
b=new Checkbox("chem",false,x);
c=new Checkbox("physics",false,x);
d=new Checkbox("biology",false,y);
e=new Checkbox("english",false,y);
f=new Checkbox("hindi",false,y);
setLayout(new FlowLayout());
add(l1); add(a); add(b); add(c);
add(l2); add(d); add(e); add(f);
}
public static void main(String args[])throws Exception
{
elec r=new elec();
r.setSize(200,300);
r.setVisible(true);
}
}
import java.awt.*;
class elec extends Frame
{
Label l1,l2;
Checkbox a,b,c,d,e,f;
CheckboxGroup x,y;
public elec()
{
setTitle("UNIVERSITY FORM:");
l1=new Label("OPTION 1:");
l2=new Label("OPTION 2:");
x=new CheckboxGroup();
y=new CheckboxGroup();
a=new Checkbox("maths",false,x);
b=new Checkbox("chem",false,x);
c=new Checkbox("physics",false,x);
d=new Checkbox("biology",false,y);
e=new Checkbox("english",false,y);
f=new Checkbox("hindi",false,y);
setLayout(new FlowLayout());
add(l1); add(a); add(b); add(c);
add(l2); add(d); add(e); add(f);
}
public static void main(String args[])throws Exception
{
elec r=new elec();
r.setSize(200,300);
r.setVisible(true);
}
}
No comments:
Post a Comment