# 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:

1. Click on the Checkbox/Radio Button component in the AWT palette tab.
2. Click in the cell where you want to place the button.
3. Open the attribute editor by clicking on its button in the main toolbar.
4. Type a unique component ID in the name box.
5. 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:

1. Click on the Radio Button Panel component in the AWT palette tab.
2. Click in the cell where you want to place the component.
3. 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).
4. Open the attribute editor by clicking on its button in the main toolbar.
5. Type a unique component ID in the name box for the radio button panel.

To add a radio button to the panel:

1. Click on the Checkbox/Radio Button component in the AWT palette tab.
2. Press and hold the Control key and click in the cells within the radio button panel in which you want to add radio buttons.
3. Open the attribute editor by clicking on its button in the main toolbar.
4. Type a unique component ID in the name box for each radio button.
5. 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