Hi If you are looking to the API, then you will find following little sample code:
As for a short description, imagine you have a bundle of Checkboxes, which belong together, like on and off or some colors. Anyway, there can be only one selection and not several. If you don't want to take RadioButtons with a ButtonGroup, then you can take Checkboxes with a CheckBoxGroup. This group manages, that there can be only one selection in its members.
Joined: Apr 27, 2001
thanks a lot but gave solution in awt. I have written following code, but its allowing multiple checkbox to be selected. ButtonGroup bg=new ButtonGroup(); JButton b1=new JButton("b1"); JButton b2=new JButton("b2"); JButton b3=new JButton("b3"); bg.add(b1);bg.add(b2);bg.add(b3); How could i allow single box to be selected. i.e equivalent of button.setCheckboxGroup() in swing. Yasir
Joined: May 02, 2002
Sorry, I forgot that you need a solution for Swing. Here is the code that you need: