Packages
 In this topic

*Constructors

*Methods

 

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

 


Class AwtUIPushButton

public class AwtUIPushButton extends AwtUIButton
{
  // Constructors
  public AwtUIPushButton();
  public AwtUIPushButton(String text);
  public AwtUIPushButton(String text, int style);
  public AwtUIPushButton(IUIComponent comp);
  public AwtUIPushButton(IUIComponent comp, int style);

  // Methods
  public void addActionListener(ActionListener l);
  public IUIComponent getBase();
  protected void processActionEvent(ActionEvent e);
  protected void processHostEvent(AWTEvent e);
  public synchronized void removeActionListener(ActionListener l);
}

This class implements the functionality of a UIPushButton object in an AWT-based control. An AwtUIPushButton control is an AwtUIHost component whose associated root container holds a UIPushButton object. By hosting this object, an AwtUIPushButton control integrates AFC with AWT. Although an AwtUIPushButton control is fully compatible with AWT, a UIPushButton control is optimized for performance and size.

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.

Panel
  |
  +--AwtUIHost
    |
    +--AwtUIControl
      |
      +--AwtUIButton
        |
        +--AwtUIPushButton

Constructors

AwtUIPushButton

public AwtUIPushButton();

Creates an AWT-based push button control with no content.

Remarks:

By default, the button's style is RAISED.

AwtUIPushButton

public AwtUIPushButton(String text);

Creates an AWT-based 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.

AwtUIPushButton

public AwtUIPushButton(String text, int style);

Creates an AWT-based 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 UIPushButton.RAISED, UIButton.TOGGLE, and UIButton.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.

AwtUIPushButton

public AwtUIPushButton(IUIComponent comp);

Creates an AWT-based push button control with the specified component.

ParameterDescription
comp The component to be displayed within the button.

Remarks:

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

AwtUIPushButton

public AwtUIPushButton(IUIComponent comp, int style);

Creates an AWT-based 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 UIPushButton.RAISED, UIButton.TOGGLE, and UIButton.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, UIGraphic, or 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 void addActionListener(ActionListener l);

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

Return Value:

No return value.

ParameterDescription
l The action listener to be added.

See Also: removeActionListener

getBase

public IUIComponent getBase();

Retrieves the UI component that the button is based on.

Return Value:

Returns the UIPushButton object associated with the button control.

Remarks:

When the AWT-based button is first created, it is associated with a UIPushButton object.

processActionEvent

protected void processActionEvent(ActionEvent e);

Processes action events.

Return Value:

No return value.

ParameterDescription
e The action event.

Remarks:

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

See Also: addActionListener

processHostEvent

protected void processHostEvent(AWTEvent e);

Processes the specified event.

Return Value:

No return value.

ParameterDescription
e The event.

Remarks:

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

Event type Method called
action event processActionEvent
component event processComponentEvent (inherited through AwtUIHost)
container event processContainerEvent (inherited through AwtUIHost)
focus event processFocusEvent (inherited through AwtUIHost)
key event processKeyEvent (inherited through AwtUIHost)
mouse event processMouseEvent (inherited through AwtUIHost)
mouse motion event processMouseMotionEvent (inherited through AwtUIHost)

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

removeActionListener

public synchronized void removeActionListener(ActionListener l);

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

Return Value:

No return value.

ParameterDescription
l The action listener to be removed.

See Also: addActionListener

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