org.gnome.gtk

## Class RadioButton

- Object
- - org.freedesktop.bindings.Pointer
  - - org.freedesktop.bindings.Proxy
    - - org.gnome.glib.Object
      - - org.gnome.gtk.Widget
        - - org.gnome.gtk.Container
          - - org.gnome.gtk.Bin
            - - org.gnome.gtk.Button
              - - org.gnome.gtk.ToggleButton
                - - org.gnome.gtk.CheckButton
                  - - org.gnome.gtk.RadioButton

- All Implemented Interfaces:
    Activatable

      public class RadioButton
      extends CheckButton

  A special kind of CheckButton used to select from a mutually exclusive set of options.

  A RadioButton is somewhat similar to a CheckButton, but it is shown as an empty circle (rather than an empty square) and the selected Button in the group us shown with a dot inside (rather than a check mark).

  However, while a CheckButton can be used alone to choose between two states, a RadioButton is used together in a group of other (related) RadioButtons to offer a choice of one of those Buttons. Only a single Button in a group can the active at any one time.

  To create a group of RadioButtons, you first create a `RadioGroup` and then construct the RadioButtons passing them that group object.

       RadioGroup group;
       RadioButton opt1, opt2, opt3;

       group = new RadioGroup();

       opt1 = new RadioButton(group, "Option _1");
       opt2 = new RadioButton(group, "Option _2");
       opt3 = new RadioButton(group, "Option _3");

  You can get the active option at any time with RadioButtonGroup's `getActive()` method. And while you can still connect a handler to the ToggleButton's `TOGGLED` signal, the `GROUP_TOGGLED` signal is provided as a convenience.

  You should generally place related RadioButtons together, better if disposed vertically, as this makes them easier to scan visually - in other words, pack them into a `VBox`. It is also frequently a good idea to place a descriptive Label at the top of the Container holding the RadioButtons. A `Frame` is a possible way to fit both requirements, as you can use it to place the RadioButtons altogether with a Label at the top:

       Frame option;
       VBox buttons;

       // Create a Frame with a descriptive Label and without outline...
       option = new Frame("Option:");
       option.setBorderWidth(3);
       option.setShadowType(ShadowType.NONE);

       // ... and with a VBox to layout the RadioButtons
       buttons = new VBox(false, 2);
       option.add(buttons);

       buttons.add(opt1);
       buttons.add(opt2);
       buttons.add(opt3);

  In your applications you will usually use RadioButtons you have two or more mutually exclusive values for an option. Note that if such values are equivalent to the concept of enable/disable a given option, `CheckButton` or `ToggleButton` are probably a better alternative. In the same way, if you have too many possible values, you should consider using a `ComboBox` instead, or even think about the possibility of simplifying your user interface.

  Since:
    4.0.7
  Author:
    Vreixo Formoso, Andrew Cowie

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.gnome.gtk.ToggleButton

      `ToggleButton.Toggled`

    - ### Nested classes/interfaces inherited from class org.gnome.gtk.Button

      `Button.Clicked`

    - ### Nested classes/interfaces inherited from class org.gnome.gtk.Widget

      `Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RadioButton(RadioGroup group, String label)` Create a new RadioButton with the given label.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RadioGroup` | `getGroup()` Get the RadioGroup that encloses this RadioButton and the others that belonging to the same mutual exclusion group.

    - ### Methods inherited from class org.gnome.gtk.ToggleButton

      `connect, getActive, setActive`

    - ### Methods inherited from class org.gnome.gtk.Button

      `connect, emitClicked, getAlignmentX, getAlignmentY, getImage, getLabel, getRelatedAction, getRelief, setAlignment, setFocusOnClick, setImage, setLabel, setRelatedAction, setRelief`

    - ### Methods inherited from class org.gnome.gtk.Bin

      `getChild`

    - ### Methods inherited from class org.gnome.gtk.Container

      `add, getChildren, remove, setBorderWidth`

    - ### Methods inherited from class org.gnome.gtk.Widget

      `activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll`

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RadioButton

          public RadioButton(RadioGroup group,
                     String label)

      Create a new RadioButton with the given label. It will be placed in its own group, you submit it later to the constructors of other Buttons that should be in the same group.
      Parameters:
        `label` - The label that will be placed near the RadioButton. If the text contains an underscore (`_`) it will be taken to be the mnemonic for the Widget.``
      Since:
        4.0.7

  - ### Method Detail

    - #### getGroup

          public RadioGroup getGroup()

      Get the RadioGroup that encloses this RadioButton and the others that belonging to the same mutual exclusion group.
      Since:
        4.0.7