Information based program in Java Script
Using the code below you can learn how to create check box in Java Swing. Check boxes can be created with swing by creating instance of JCheckBox class using constructor.
It contains the string which has to be shown beside the check box on the frame.
Import javax.swing.*;
public class create checkbox{
public static void main (String[] args{
JFrame frame = new JFrame (“Check Box Frame”);
JCheckBox chk = new JCheckBox (“This is the Check Box”);
frame.add (chk);
frame.setSize (350, 350);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Hope you will be able to create a check box using Java.
Regards,
Charlio Sanhy.