group « JCheckBox « Java Swing Q&A





1. Uncheck all checkboxes added as a group    stackoverflow.com

I have 4 checkboxes added as a group so that I will be able to select only one checkbox. But if I select one of them and now want to uncheck all ...

2. Creating a Button Group Allowing N checked boxes    stackoverflow.com

I am programming in Java, using Swing. I am currently working with an application which allows the user to display 2 or less hobbies. The list of hobbies is finite. ...

3. check box group    coderanch.com

Sorry, I forgot that you need a solution for Swing. Here is the code that you need: import javax.swing.*; import java.awt.*; public class CheckBoxTest extends JFrame { JPanel jPanel1 = new JPanel(); GridBagLayout gridBagLayout1 = new GridBagLayout(); JCheckBox chb1 = new JCheckBox(); JCheckBox chb2 = new JCheckBox(); JCheckBox chb3 = new JCheckBox(); JCheckBox chb4 = new JCheckBox(); ButtonGroup buttonGroup1 = new ...