## com.google.gwt.user.client.ui
Class RadioButton

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.FocusWidget
                  com.google.gwt.user.client.ui.ButtonBase
                      com.google.gwt.user.client.ui.CheckBox
                          com.google.gwt.user.client.ui.RadioButton

All Implemented Interfaces:
  EventListener, HasFocus, HasHTML, HasName, HasText, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents

    public class RadioButton

extends CheckBox

A mutually-exclusive selection radio button widget.

### CSS Style Rules

- .gwt-RadioButton { }

### Example

>     public class RadioButtonExample implements EntryPoint {

>       public void onModuleLoad() {
>         // Make some radio buttons, all in one group.
>         RadioButton rb0 = new RadioButton("myRadioGroup", "foo");
>         RadioButton rb1 = new RadioButton("myRadioGroup", "bar");
>         RadioButton rb2 = new RadioButton("myRadioGroup", "baz");

>         // Check 'baz' by default.
>         rb2.setChecked(true);

>         // Add them to the root panel.
>         FlowPanel panel = new FlowPanel();
>         panel.add(rb0);
>         panel.add(rb1);
>         panel.add(rb2);
>         RootPanel.get().add(panel);
>       }
>     }

Nested Class Summary

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`RadioButton(java.lang.String name)` Creates a new radio associated with a particular group name.
`RadioButton(java.lang.String name, java.lang.String label)` Creates a new radio associated with a particular group, and initialized with the given HTML label.
`RadioButton(java.lang.String name, java.lang.String label, boolean asHTML)` Creates a new radio button associated with a particular group, and initialized with the given label (optionally treated as HTML).

Method Summary
`void` `setName(java.lang.String name)` Change the group name of this radio button.

Methods inherited from class com.google.gwt.user.client.ui.CheckBox
`getHTML, getName, getTabIndex, getText, isChecked, isEnabled, onEnsureDebugId, onLoad, onUnload, replaceInputElement, setAccessKey, setChecked, setEnabled, setFocus, setHTML, setTabIndex, setText, sinkEvents`

Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
`addClickListener, addFocusListener, addKeyboardListener, getFocusImpl, onBrowserEvent, removeClickListener, removeFocusListener, removeKeyboardListener, setElement`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onDetach, removeFromParent`

Methods inherited from class com.google.gwt.user.client.ui.UIObject

`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### RadioButton

    public RadioButton(java.lang.String name)

  Creates a new radio associated with a particular group name. All radio buttons associated with the same group name belong to a mutually-exclusive set. Radio buttons are grouped by their name attribute, so changing their name using the setName() method will also change their associated group.

  Parameters:
    `name` - the group name with which to associate the radio button

### RadioButton

    public RadioButton(java.lang.String name,
                       java.lang.String label)

  Creates a new radio associated with a particular group, and initialized with the given HTML label. All radio buttons associated with the same group name belong to a mutually-exclusive set. Radio buttons are grouped by their name attribute, so changing their name using the setName() method will also change their associated group.

  Parameters:
    `name` - the group name with which to associate the radio button
    `label` - this radio button's label

### RadioButton

    public RadioButton(java.lang.String name,
                       java.lang.String label,
                       boolean asHTML)

  Creates a new radio button associated with a particular group, and initialized with the given label (optionally treated as HTML). All radio buttons associated with the same group name belong to a mutually-exclusive set. Radio buttons are grouped by their name attribute, so changing their name using the setName() method will also change their associated group.

  Parameters:
    `name` - name the group with which to associate the radio button
    `label` - this radio button's label
    `asHTML` - `true` to treat the specified label as HTML

Method Detail

### setName

    public void setName(java.lang.String name)

  Change the group name of this radio button. Radio buttons are grouped by their name attribute, so changing their name using the setName() method will also change their associated group. If changing this group name results in a new radio group with multiple radio buttons selected, this radio button will remain selected and the other radio buttons will be unselected.

  Specified by:
    `setName` in interface `HasName`
  Overrides:
    `setName` in class `CheckBox`
  Parameters:
    `name` - name the group with which to associate the radio button