Button groups (javax.swing.ButtonGroup
) are used in
combination with radio buttons to ensure that only one radio button in
a group of radio buttons is selected.
To visualize the grouping, JFormDesigner displays lines connecting the grouped buttons.
To create a new button group, select the buttons you want to group, right-click on a selected button and select Group Buttons from the popup menu.
You can extend existing button groups by selecting at least one button of the existing group and the buttons that you want to add to that group, then right-click on a selected button and select Group Buttons from the popup menu.
Note that the Group Buttons and Ungroup Buttons
commands are only available in the context menu if the selection
contains only components that are derived from JToggleButton
(JRadioButton
and JCheckBox
).
To remove a button group, select all buttons of the group, right-click on a selected button and select Ungroup Buttons from the popup menu.
To remove a button from a group, right-click on it and select Ungroup Buttons from the popup menu.
Button groups are non-visual beans. They appear at the bottom of the Structure view and in the Design view. JFormDesigner automatically creates and removes those objects. You can rename button group objects.
If a grouped button is selected, you can see the association to the button group in the Properties view.