Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class UICheckButton

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

  // Methods
  public synchronized void addItemListener(IUIItemListener l);
  public int getCheckImageSize();
  public Insets getInsets();
  public Dimension getMinimumSize();
  public Dimension getPreferredSize();
  public int getRoleCode();
  public void paint(FxGraphics g);
  public void paintCheck(FxGraphics g);
  protected void processEvent(UIEvent e);
  protected void processItemEvent(UIItemEvent e);
  public synchronized void removeItemListener(IUIItemListener l);
  public void setChecked(boolean on);
  public void setCheckImageSize(int imageSize);
  public void setHot(boolean on);
  public void setID(int id);
  public void setIndeterminate(boolean on);
  public void setName(String name);
  public void setPressed(boolean on);
  public void setSelected(boolean on);
}

This class implements a check box button control. By default, UICheckButton uses the system-defined check box image.

For more information about buttons, see the UIButton overview.

Note The behavior of the action method is not identical to the behavior of AWT components. for more information, see the overview information in UIButton.

Note The hot-track color is the same color as the button text color. As a result, hot-tracking does not appear to be functional.

UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UISingleContainer
        |
        +--UIButton
          |
          +--UICheckButton

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 with the specified text.

ParameterDescription
name The text to be displayed with the check box image.

Remarks:

By default, the button is hot-tracked and its style is set to TOGGLE. To create a button that is not hot-tracked, pass a UIText object instead of a String. For more information about hot-tracking, see the UIButton overview.

UICheckButton

public UICheckButton(String name, int style);

Creates a check box button control with the specified text and style.

ParameterDescription
name The text to be displayed with the check box image.
style The style of the button. Possible values include TOGGLE or TRITOGGLE.

Remarks:

By default, the button is hot-tracked. To create a button that is not hot-tracked, pass a UIText object instead of a String. For more information about hot-tracking, see the UIButton overview.

Exceptions:

IllegalArgumentException if an undefined style was specified.

UICheckButton

public UICheckButton(IUIComponent comp);

Creates a check box button control with the specified component.

ParameterDescription
comp The component to be displayed with the check box image.

Remarks:

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

UICheckButton

public UICheckButton(IUIComponent comp, int style);

Creates a check box button control with the specified component and style.

ParameterDescription
comp The component to be displayed with the check box image.
style The style of the button. Possible values include TOGGLE or TRITOGGLE.

Remarks:

Typically, you'll pass a UIText, a UIGraphic, or a UIItem object for the component. For examples of constructing buttons, see the UIButton overview.

Exceptions:

IllegalArgumentException if an undefined style was specified.

Methods

addItemListener

public synchronized void addItemListener(IUIItemListener l);

Adds the specified item listener. The listener receives all item events generated for the control. (Item events are generated when the state of an item changes.)

Return Value:

No return value.

ParameterDescription
l The item listener to be added.

See Also: removeItemListener

getCheckImageSize

public int getCheckImageSize();

Retrieves the square dimensions of the check box image that is associated with the button control.

Return Value:

Returns the square dimensions (in pixels) of the check box's image.

See Also: setCheckImageSize

getInsets

public Insets getInsets();

Retrieves the button control's insets (in pixels), which identify the non-client area of the control.

Return Value:

Returns an Insets object that contains the control's insets.

Remarks:

The left inset value includes the size of the check box image plus two pixels for the space between the check box image and the content component.

getMinimumSize

public Dimension getMinimumSize();

Retrieves the minimum size of the check box button control. The minimum size specifies the smallest dimensions (in pixels) that will allow the button's content component and check box image to be displayed.

Return Value:

Returns a Dimension object containing the minimum size.

See Also: getPreferredSize

getPreferredSize

public Dimension getPreferredSize();

Retrieves the preferred size (in pixels) of the check box button control.

Return Value:

Returns a Dimension object containing the preferred size.

Remarks:

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

getRoleCode

public int getRoleCode();

Retrieves the ROLE_SYSTEM code that best describes the role of the check box button.

Return Value:

Returns the ROLE_SYSTEM_CHECKBUTTON code.

paint

public void paint(FxGraphics g);

Draws the check box button control.

Return Value:

No return value.

ParameterDescription
g The graphics context.

Remarks:

This method draws the button's content component, and calls paintCheck to draw the check box image.

paintCheck

public void paintCheck(FxGraphics g);

Draws the check box image, according to the button control's current state.

Return Value:

No return value.

ParameterDescription
g The graphics context.

Remarks:

This method is called by paint.

processEvent

protected void processEvent(UIEvent e);

Processes the specified event.

Return Value:

No return value.

ParameterDescription
e The event.

Remarks:

This method is automatically invoked if a listener has been registered through a call to addXXXListener. Depending on the type of event, processEvent calls one of the following methods.

Event type Method called
item event processItemEvent
action event processActionEvent (inherited through UIButton)
container event processContainerEvent (inherited through UIStateContainer)
focus event processFocusEvent (inherited through UIStateContainer)
key event processKeyEvent (inherited through UIStateContainer)
mouse event processMouseEvent (inherited through UIStateContainer)
mouse motion event processMouseMotionEvent (inherited through UIStateContainer)

When overriding processEvent, call the super event processEvent to ensure the default event processing continues normally.

Overrides:

processEvent(UIEvent) in UIButton.

processItemEvent

protected void processItemEvent(UIItemEvent e);

Processes item events.

Return Value:

No return value.

ParameterDescription
e The item event.

Remarks:

This method is called by processEvent and dispatches the event to a registered item listener. When overriding this method, call the super method processItemEvent to ensure the default event processing continues normally.

See Also: addItemListener

removeItemListener

public synchronized void removeItemListener(IUIItemListener l);

Removes the specified item listener. The listener no longer receives the control's item events.

Return Value:

No return value.

ParameterDescription
l The item listener to be removed.

See Also: addItemListener

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 redraws the check box's image to display the new state. For more information about states, see the UIStateContainer overview.

See Also: getPreferredSize

setCheckImageSize

public void setCheckImageSize(int imageSize);

Sets the square dimensions of the check box image that is associated with the button control.

Return Value:

No return value.

ParameterDescription
imageSize The square dimensions (in pixels) of the check box's image.

Remarks:

This method provides the ability to control the size of the check box's or radio button's image.

See Also: getCheckImageSize

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 redraws the check box image to display the new state. For more information about states, see the UIStateContainer overview.

Overrides:

setHot(boolean) in UIButton.

setID

public void setID(int id);

Sets the container's identifier.

Return Value:

No return value.

ParameterDescription
id The value to be associated with the container.

See Also: setName

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 redraws the check box image to display the new state. For more information about states, see the UIStateContainer overview.

setName

public void setName(String name);

Sets the container's name.

Return Value:

No return value.

ParameterDescription
name The name to be associated with the container.

See Also: setID

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 redraws the check box image to display the new state. For more information about states, see the UIStateContainer 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.

Remarks:

For more information about states, see the UIStateContainer overview.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.