Adding Checkboxes and Radio Buttons
Besides the standard text button, you can add checkboxes or radio
buttons to your layout:
- Checkbox. Allows for multiple selection
when more than one checkbox is added
- Radio Button Panel. Creates a panel into
which you can add a series of radio buttons
- Radio Button. Toggles a Boolean state; only
one radio button selection can be made
To add a checkbox:
- Click on the Checkbox/Radio Button component in the AWT palette tab.
- Click in the cell where you want to place the button.
- Open the attribute editor by clicking on its button in the main
toolbar.
- Type a unique component ID in the name box.
- For a labeled checkbox, type a label in the text box.
You cannot add checkboxes to a Radio Button panel. When you add
the Checkbox/Radio Button component to a cell within a Radio Button
panel, radio buttons are inserted.
To add a radio button panel:
- Click on the Radio Button Panel component in the AWT palette tab.
- Click in the cell where you want to place the component.
- Click in the radio button panel cell and click the arrow keys
to create rows (arrow up or down) and columns (arrow left or right).
- Open the attribute editor by clicking on its button in the main
toolbar.
- Type a unique component ID in the name box for the radio button
panel.
To add a radio button to
the panel:
- Click on the Checkbox/Radio Button component in the AWT palette tab.
- Press and hold the Control key and click in the cells within
the radio button panel in which you want to add radio buttons.
- Open the attribute editor by clicking on its button in the main
toolbar.
- Type a unique component ID in the name box for each radio button.
- For a labeled radio button, type a label in the text box.
You cannot add radio buttons to a cell that is not in a radio button
panel. When you add the Checkbox/Radio Button component to a cell
not within a radio button panel, a checkbox is inserted.
Special Attributes
For checkbox or radio button:
state |
Sets the initial state of the checkbox or radio button to true or
false. |
For radio panel:
borderlabelAlignment |
Sets the position (left, right, center) of the
label on the top edge of the panel. |
See also:
- Laying Out the Interface
- Generating Java Source Code
- Adding Operations to Components
- GUI Builder Palette
- Visual Java GUI Builder API Documentation
- Visual Java GUI
Builder Runtime Packages
- Class Hierarchy
- Index of
All Fields and Methods