Package com.ms.ui Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class UIRadioButton

Constructors , Methods

public class UIRadioButton extends UICheckButton
{
  // Constructors
  public UIRadioButton();
  public UIRadioButton(String name);
  public UIRadioButton(String name, int style);
  public UIRadioButton(Component comp);
  public UIRadioButton(Component comp, int style);

  // Methods
  public int getRoleCode();
  public void paintCheck(Graphics g);

}

A class that implements a radio button control. See the UIButton overview for more information about using buttons.


Constructors


UIRadioButton

public UIRadioButton();

Creates a radio button control with no content.

Remarks:

By default, the button's style is set to TOGGLE.


UIRadioButton

public UIRadioButton(String name);

Creates a radio button control using the specified text for content.

ParameterDescription
name The text to be displayed with the radio button.

Remarks:

By default, the button's style is set to TOGGLE, and the text is left-aligned and hot-tracked. To create a button whose text is not hot-tracked, pass a UIText object instead of a String, as shown in the following example.

UIRadioButton r = 
   new UIRadioButton(new UIText("Text not hot-tracked"));

For more information about hot-tracking, see the UIButton overview.


UIRadioButton

public UIRadioButton(String name, int style);

Creates a radio button control using the specified text for content and the specified style.

ParameterDescription
name The text to be displayed with the radio button.
style The style of the button. Specify UIButton.TOGGLE or UIButton.TRITOGGLE.

Remarks:

By default, the text is left-aligned and hot-tracked. If any undefined style bits are specified, an IllegalArgumentException is thrown.

To create a button whose text is not hot-tracked, pass a UIText object instead of a String, as shown in the following example.

UIRadioButton r = 
   new UIRadioButton(new UIText("Text not hot-tracked"), 0);

For more information about hot-tracking, see the UIButton overview.


UIRadioButton

public UIRadioButton(Component comp);

Creates a radio button control using the specified component for content.

ParameterDescription
comp The component to be displayed with the button.

Remarks:

By default, the component is centered and the button's style is set to TOGGLE. Typically, you'll pass a UIText, UIGraphic, or UIItem object for the component. For examples of how to construct buttons, see the UIButton overview.


UIRadioButton

public UIRadioButton(Component comp, int style);

Creates a radio button control using the specified component for content and the specified style.

ParameterDescription
comp The component to be displayed with the button.
style The style of the button. Specify UIButton.TOGGLE or UIButton.TRITOGGLE.

Remarks:

By default, the component is centered. If any undefined style bits are specified, an IllegalArgumentException is thrown. Typically, you'll pass a UIText, UIGraphic, or UIItem object for the component. For examples of how to construct buttons, see the UIButton overview.


Methods


getRoleCode

public int getRoleCode();

Retrieves the role of the radio button.

Return Value:

Returns the ROLE_SYSTEM code that best describes the role of the button.

Remarks:

This method returns the ROLE_SYSTEM_RADIOBUTTON code.


paintCheck

public void paintCheck(Graphics g);

Paints the radio button image.

ParameterDescription
g The graphics context.

Remarks:

This method is called by paint, inherited through UICheckButton.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.