RadioButton Class

RadioButton Class

This Package | All Packages

Component
  |
  +--Control
    |
    +--RadioButton
public class RadioButton
extends Control

Encapsulates a radio button control. The control is a small circle that has the given text displayed next to it, typically to its right. The control highlights the circle and sends a message to its parent window when the user selects the button. The control removes the highlight and sends a message when the button is next selected.

Constructors
Name Description
RadioButton() Creates a RadioButton control.

Methods
Name Description
addOnCheckedChanged(EventHandler handler) Adds a listener to the OnCheckedChanged event.
getAlignText() Retrieves the current text alignment for this control.
getAuto() Retrieves a boolean value that indicates whether this button is checked, by default, where the button is a member of a group of buttons.
getChecked() Retrieves a boolean value that indicates whether the button is checked.
getPushLike() Retrieves a boolean value that indicates whether the button has the PushLike style set.
onCheckedChanged(Event e) The onCheckedChanged event occurs when the value of the Checked property changes.
onClick(Event e) The onClick event occurs when the user clicks on the RadioButton.
performClick() Simulates a user click on the control.
removeOnCheckedChanged(EventHandler handler) Removes an OnCheckedChanged event listener.
setAlignText(int value) Sets the text alignment on this control.
setAuto(boolean value) Specifies whether this button is automatically checked when it is a member of a group of buttons.
setChecked(boolean value) Sets the checked value for the button.
setPushLike(boolean value) Sets the PushLike style on the button.

Constructors

RadioButton.RadioButton

Syntax
public RadioButton();
Description

Creates a RadioButton control.

Methods

RadioButton.addOnCheckedChanged

Syntax
public final void addOnCheckedChanged( EventHandler handler );
Parameters
handler
Delegate to notify when the event occurs.
Description

Adds a listener to the OnCheckedChanged event.

See Also
removeOnCheckedChanged, onCheckedChanged

RadioButton.getAlignText

Syntax
public final int getAlignText();
Return Value

Returns one of the constants defined in the LeftRightAlignment class.

Description

Retrieves the current text alignment for this control.

See Also
setAlignText

RadioButton.getAuto

Syntax
public final boolean getAuto();
Return Value

Returns true if the button is to be automatically checked; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether this button is checked, by default, where the button is a member of a group of buttons. Only one button in the group can be checked.

RadioButton.getChecked

Syntax
public final boolean getChecked();
Return Value

Returns true if the button is checked; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the button is checked.

RadioButton.getPushLike

Syntax
public final boolean getPushLike();
Return Value

Returns true if the button is currently configured to behave like a push button; otherwise, returns false.

Description

Retrieves a boolean value that indicates whether the button has the PushLike style set. Setting the PushLike style makes a radio button look and act like a push button. The button looks raised when it isn&#-110;t pushed or checked and sunken when it is pushed or checked.

See Also
setPushLike

RadioButton.onCheckedChanged

Syntax
protected void onCheckedChanged( Event e );
Parameters
e
Event data.
Description

The onCheckedChanged event occurs when the value of the Checked property changes.

RadioButton.onClick

Syntax
protected void onClick( Event e );
Parameters
e
Event data.
Description

The onClick event occurs when the user clicks on the RadioButton.

Overrides

onClick(Event) in Control.

RadioButton.performClick

Syntax
public final void performClick();
Description

Simulates a user click on the control.

RadioButton.removeOnCheckedChanged

Syntax
public final void removeOnCheckedChanged( EventHandler handler );
Parameters
handler
The delegate to remove from the event.
Description

Removes an OnCheckedChanged event listener.

See Also
addOnCheckedChanged, onCheckedChanged

RadioButton.setAlignText

Syntax
public final void setAlignText( int value );
Parameters
value
One of the constants defined by the LeftRightAlignment class.
Description

Sets the text alignment on this control.

See Also
getAlignText

RadioButton.setAuto

Syntax
public final void setAuto( boolean value );
Parameters
auto
If true, this button becomes the auto button for the group; otherwise, it does not.
Description

Specifies whether this button is automatically checked when it is a member of a group of buttons. Only one radio button for a given container can be the auto button for the group.

See Also
getAuto

RadioButton.setChecked

Syntax
public final void setChecked( boolean value );
Parameters
value
If true, the button is checked; otherwise, it is not.
Description

Sets the checked value for the button.

RadioButton.setPushLike

Syntax
public final void setPushLike( boolean value );
Parameters
push
If true, the button looks and behaves like a push button. Otherwise, it behaves like a standard radio button.
Description

Sets the PushLike style on the button. Setting the PushLike style makes a radio button look and act like a push button. The button looks raised when it isn&#-110;t pushed or checked,and sunken when it is pushed or checked.

See Also
getPushLike