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

Class UICheckButton

Constructors , Methods

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

  // Methods
  public void setChecked(boolean on);
  public void setHot(boolean on);
  public void setIndeterminate(boolean on);
  public void setPressed(boolean on);
  public void setSelected(boolean on);
  
  public Dimension minimumSize();
  public Dimension preferredSize();

  public int getRoleCode();

  public void layout();
  public void paint(Graphics g);
  public void paintCheck(Graphics g);

}

A class that implements a check box button control. For more information about using buttons, See the UIButton overview.


Constructors


UICheckButton

public UICheckButton();

Creates a check box button control with no content.

Remarks:

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


UICheckButton

public UICheckButton(String name);

Creates a check box button control using the specified text for content.

ParameterDescription
name The text to be displayed with the check box 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.

UICheckButton c = 
   new UICheckButton(new UIText("Text not hot-tracked"));

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


UICheckButton

public UICheckButton(String name, int style);

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

ParameterDescription
name The text to be displayed with the check box 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.

UICheckButton c = 
   new UICheckButton(new UIText("Text not hot-tracked"), 0);

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


UICheckButton

public UICheckButton(Component comp);

Creates a check box button control using the specified component for content.

ParameterDescription
comp The component to be displayed with the check box 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.


UICheckButton

public UICheckButton(Component comp, int style);

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

ParameterDescription
comp The component to be displayed with the check box 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 check box button.

Return Value:

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

Remarks:

This method returns the ROLE_SYSTEM_CHECKBUTTON code.


layout

public void layout();

Lays out the check box button control.

Return Value:

No return value.


minimumSize

public Dimension minimumSize();

Determines the minimum size of the check box button control. The minimum size specifies the smallest dimensions (in pixels) that will allow the button and its content to be displayed.

Return Value:

Returns a Dimension object containing the minimum size.


paint

public void paint(Graphics g);

Draws the check box button control.

Return Value:

No return value.

ParameterDescription
g The graphics context.

Remarks:

This method calls paintCheck to draw the check box image. The button control's content is also redrawn.


paintCheck

public void paintCheck(Graphics g)

Draws the check box image.

ParameterDescription
g The graphics context.

Remarks:

This method is called by paint.


preferredSize

public Dimension preferredSize();

Determines the preferred size of the check box button control. The preferred size specifies the dimensions (in pixels) you want for the button.

Return Value:

Returns a Dimension object containing the preferred size.

Remarks:

By default, this method returns the minimum size, as determined by minimumSize.


setChecked

public void setChecked(boolean on);

Sets or clears the checked state of the button.

Return Value:

No return value.

ParameterDescription
on If true, the checked state is set; otherwise, it is cleared.

Remarks:

This method automatically redraws the check box image to display the new state. For more information about button states, see the UIButton overview.


setHot

public void setHot(boolean on);

Sets or clears the hot-tracked state of the button.

Return Value:

No return value.

ParameterDescription
on If true, the hot-tracked state is set; otherwise, it is cleared.

Remarks:

This method automatically redraws the check box image to display the new state. For more information about button states, see the UIButton overview.


setIndeterminate

public void setIndeterminate(boolean on);

Sets or clears the indeterminate state of the button.

Return Value:

No return value.

ParameterDescription
on If true, the indeterminate state is set; otherwise, it is cleared.

Remarks:

This method automatically redraws the check box image to display the new state. For more information about button states, see the UIButton overview.


setPressed

public void setPressed(boolean on);

Sets or clears the pressed state of the button.

Return Value:

No return value.

ParameterDescription
on If true, the pressed state is set; otherwise, it is cleared.

Remarks:

This method automatically redraws the check box image to display the new state. For more information about button states, see the UIButton overview.


setSelected

public void setSelected(boolean on);

Sets or clears the selected state of the button.

Return Value:

No return value.

ParameterDescription
on If true, the selected state is set; otherwise, it is cleared.



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