Check1.java
Aim:
To display check boxes using AWT Frame.
Source code:
import java.awt.*;
public class Check1
{
public static void main(String args[])
{
Frame f=new Frame("Check box example");
Checkbox ch1=new Checkbox("c");
ch1.setBounds(100,100,50,50);
Checkbox ch2=new Checkbox("c++");
ch2.setBounds(100,150,50,50);
Checkbox ch3=new Checkbox("java");
ch3.setBounds(100,200,50,50);
Checkbox ch4=new Checkbox("python");
ch4.setBounds(100,250,50,50);
f.add(ch1);
f.add(ch2);
f.add(ch3);
f.add(ch4);
f.setSize(500,500);
f.setLayout(null);
f.setVisible(true);
}
}
Output:
No comments:
Post a Comment