Class RadioButton

java.lang.Object
All Implemented Interfaces:
IsEditor<LeafValueEditor<Boolean>>, HasAllDragAndDropHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasAllTouchHandlers, HasBlurHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragEndHandlers, HasDragEnterHandlers, HasDragHandlers, HasDragLeaveHandlers, HasDragOverHandlers, HasDragStartHandlers, HasDropHandlers, HasFocusHandlers, HasGestureChangeHandlers, HasGestureEndHandlers, HasGestureStartHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasTouchCancelHandlers, HasTouchEndHandlers, HasTouchMoveHandlers, HasTouchStartHandlers, HasAttachHandlers, HasValueChangeHandlers<Boolean>, HasHandlers, HasDirectionEstimator, HasSafeHtml, EventListener, TakesValue<Boolean>, Focusable, HasDirectionalSafeHtml, HasDirectionalText, HasEnabled, HasFocus, HasHTML, HasName, HasText, HasValue<Boolean>, HasVisibility, HasWordWrap, IsWidget, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents, SourcesMouseEvents

public class RadioButton extends CheckBox
A mutually-exclusive selection radio button widget. Fires ClickEvents when the radio button is clicked, and ValueChangeEvents when the button becomes checked. Note, however, that browser limitations prevent ValueChangeEvents from being sent when the radio button is cleared as a side effect of another in the group being clicked.

Built-in Bidi Text Support

This widget is capable of automatically adjusting its direction according to its content. This feature is controlled by CheckBox.setDirectionEstimator(boolean) or passing a DirectionEstimator parameter to the constructor, and is off by default.

CSS Style Rules

.gwt-RadioButton
the outer element

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);
  }
}