arrow_back history picture_as_pdf This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ~~NOTRANS~~ ~~Title: Using ActionGroup~~ If you have multiple radio/toggle buttons in your UI and have the use-case that only one button should be selected, the ActionGroup is a perfect match. The ActionGroup handles a set of radio/toggle buttons and ensures that only one button in the group is selected. The ActionGroup has an action event that triggers notifications when the selection has been changed. <file java> UIRadioButton butHLeft = new UIRadioButton("Left"); UIRadioButton butHCenter = new UIRadioButton("Center"); UIRadioButton butHRight = new UIRadioButton("Right"); UIRadioButton butHStretch = new UIRadioButton("Stretch"); ActionGroup buttonGroup = new ActionGroup(butHLeft, butHCenter, butHRight, butHStretch); </file> The selected button can be changed programmatically by index <file java> buttonGroup.setSelectedIndex(1); // Choose the selected index </file> or by button instance <file java> buttonGroup.setSelectedButton(butHLeft); // Choose the selected button </file> \\ Use **eventAction** to get notifications about selection changes: <file java> buttonGroup.eventAction().addListener(this, “doSelectionChanged”); </file>