Packages
 In this topic

*Constructors

*Methods

*Fields

 

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

 


Class UIPushButton

public class UIPushButton extends UIButton
{
  // Fields
  public static final int FLAT_PRESSED;
  public static final int RAISED;
  public static final int THICK;

  // Constructors
  public UIPushButton();
  public UIPushButton(String text);
  public UIPushButton(String text, int style);
  public UIPushButton(IUIComponent comp);
  public UIPushButton(IUIComponent comp, int style);

  // Methods
  public synchronized void addActionListener(IUIActionListener l);
  public Insets getInsets();
  public int getRoleCode();
  public void paint(FxGraphics g);
  protected void processActionEvent(UIActionEvent e);
  protected void processEvent(UIEvent e);
  public synchronized void removeActionListener(
        IUIActionListener l);
  public void setChecked(boolean on);
  public void setFocused(boolean on);
  public void setHot(boolean on);
  public void setPressed(boolean on);
  public void setStyle(int style);
}

This class implements a push button control. For more information about buttons, see the UIButton overview.

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
          |
          +--UIPushButton

Constructors

UIPushButton

public UIPushButton();

Creates a push button control with no content.

Remarks:

By default, the button's style is RAISED.

UIPushButton

public UIPushButton(String text);

Creates a push button control with the specified text.

ParameterDescription
text The text to be displayed within the button.

Remarks:

By default, the button is hot-tracked and has a flat style. 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.

UIPushButton

public UIPushButton(String text, int style);

Creates a push button control with the specified text and style.

ParameterDescription
text The text to be displayed within the button.
style The style of the button. Possible values include any bitwise combination of RAISED, TOGGLE, and TRITOGGLE. (Combining TOGGLE and TRITOGGLE results in TRITOGGLE.) To specify a flat style, pass 0 for this parameter.

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.

UIPushButton

public UIPushButton(IUIComponent comp);

Creates a push button control with the specified component.

ParameterDescription
comp The component to be displayed within the button.

Remarks:

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

UIPushButton

public UIPushButton(IUIComponent comp, int style);

Creates a push button control with the specified component and style.

ParameterDescription
comp The component to be displayed within the button.
style The style of the button. Possible values include any bitwise combination of RAISED, TOGGLE, and TRITOGGLE. (Combining TOGGLE and TRITOGGLE results in TRITOGGLE.) To specify a flat style, pass 0 for this parameter.

Remarks:

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

Exceptions:

IllegalArgumentException if an undefined style was specified.

Methods

addActionListener

public synchronized void addActionListener(IUIActionListener l);

Adds the specified action listener. The listener receives all action events generated for the button.

Return Value:

No return value.

ParameterDescription
l The action listener to be added.

Overrides:

addActionListener(IUIActionListener) in UIButton.

See Also: removeActionListener

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 button control's insets are based on its current styles and states.

getRoleCode

public int getRoleCode();

Retrieves the ROLE_SYSTEM code that best describes the role of the push button.

Return Value:

Returns the ROLE_SYSTEM_PUSHBUTTON code.

paint

public void paint(FxGraphics g);

Draws the push button control, according to its current states and styles.

Return Value:

No return value.

ParameterDescription
g The graphics context.

processActionEvent

protected void processActionEvent(UIActionEvent e);

Processes action events.

Return Value:

No return value.

ParameterDescription
e The action event.

Remarks:

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

Overrides:

processActionEvent(UIActionEvent) in UIButton.

See Also: addActionListener

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
action event processActionEvent
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 method processEvent to ensure the default event processing continues normally.

Overrides:

processEvent(UIEvent) in UIButton.

removeActionListener

public synchronized void removeActionListener(IUIActionListener l);

Removes the specified action listener. The listener no longer receives the button's action events.

Return Value:

No return value.

ParameterDescription
l The action listener to be removed.

Overrides:

removeActionListener(IUIActionListener) in UIButton.

See Also: addActionListener

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 lays out the button control to display the new state. For more information about states, see the UIStateContainer overview.

setFocused

public void setFocused(boolean on);

Sets or clears the focus state of the button.

Return Value:

No return value.

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

Remarks:

This method lays out the button control, as needed, to display the new state. For more information about states, see the UIStateContainer 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 lays out the button control, as needed, to display the new state. For more information about states, see the UIStateContainer overview.

Overrides:

setHot(boolean) in UIButton.

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 lays out the button control to display the new state. For more information about states, see the UIStateContainer overview.

setStyle

public void setStyle(int style);

Sets the current style for the button.

Return Value:

No return value.

ParameterDescription
style The style of the button. You can pass any bitwise combination of RAISED, TOGGLE, and TRITOGGLE. that combining TOGGLE and TRITOGGLE results in TRITOGGLE.) To specify a flat style, pass 0 for this parameter.

Overrides:

setStyle(int) in UIButton.

Exceptions:

IllegalArgumentException if an undefined style was specified.

Fields

FLAT_PRESSED
Specifies that the push button has a flat look when pressed.
RAISED
Specifies that the push button is raised.
THICK
Specifies that the push button has a thicker three-dimensional bevel edge.

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