Getting and Setting the State of a JCheckbox Component

// To create a checkbox, see Creating a JCheckbox Component // Get the current state of the checkbox boolean b = checkbox.isSelected(); // Set the state of the checkbox to off checkbox.setSelected(false); // Set the state of the checkbox to on checkbox.setSelected(true);

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.