Swing (javax.swing)Creating a Checkbox ButtonJCheckBox checkBox = new JCheckBox("Label"); checkBox.addActionListener(actionListener); // Set the current state of the checkbox. checkBox.setSelected(false); // Get the current state of the checkbox. boolean on = checkBox.isSelected(); |