What is Check Box?
A check box or tick box is a graphical user interface element that allow or permits user to make selections from the options. User can select more than one item or element.
The given example will explain you how to create check box in java swing. It is created in java by creating the instance of JCheckBo class. Here is the check box program :
public class CreateCheckBox{
public static void main(String[] args){
JFrame frame = new JFrame("The Check Box Example");
JCheckBox chk = new JCheckBox("Check Box 1");
JCheckBox chk = new JCheckBox("Check Box 2");
JCheckBox chk = new JCheckBox("Check Box 3");
frame.add(chk);
frame.setSize(400, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Showing posts with label beginners java. Show all posts
Showing posts with label beginners java. Show all posts
Tuesday, June 17, 2008
Monday, March 3, 2008
Print Triangle using "*"
import java.io.*;
class startriangle{
public static void main(String[] args) {
try{
BufferedReader object = new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter the number");
int a= Integer.parseInt(object.readLine());
for (int i=1; i<'a;i++ ){
for (int j=1; j<=i;j++ ){
System.out.print("*");
}
System.out.println("");
}
}
catch(Exception e){}
}
}
Subscribe to:
Posts (Atom)