Packages
 In this topic

*Constructors

*Methods

 

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

 


Class AwtUIButton

public abstract class AwtUIButton extends AwtUIControl
{
  // Constructors
  public AwtUIButton();

  // Methods
  public int getStyle();
  public boolean keyDown(Event e, int key);
  public boolean keyUp(Event e, int key);
  public boolean mouseUp(Event e, int x, int y);
  public void setLabel(String name);
  public void setStyle(int style);
}

This class implements the functionality of a UIButton object in an AWT-based control. The following classes extend AwtUIButton and allow you to create AWT-based buttons.

While an AwtUIButton control is fully compatible with AWT, a UIButton control is optimized for performance and size.

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

Constructors

AwtUIButton

public AwtUIButton();

Creates an AWT-based button control.

Methods

getStyle

public int getStyle();

Retrieves the button's current style settings.

Return Value:

Returns an integer containing the current style settings. For a list of possible styles, see setStyle.

keyDown

public boolean keyDown(Event e, int key);

Determines whether the SPACEBAR or the ENTER key is being pressed, and if so, sets the pressed state.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the button control.
key The key that has been pressed.

Remarks:

This method is called when the button has focus and a key is pressed. If the key being pressed is the SPACEBAR or the ENTER key, the button's pressed state is set. If the ESC key is being pressed, the button's pressed state is cleared.

For more information about states, see the UIStateContainer overview.

See Also: keyUp

keyUp

public boolean keyUp(Event e, int key);

Determines whether the SPACEBAR or the ENTER key is being released, and if so, generates an action event.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the button control.
key The key that has been released.

Remarks:

This method is called when the button has focus and a key is released. If the key being released is the SPACEBAR or the ENTER key, an action event is generated. The keyUp method also clears the button's pressed state, which was previously set by keyDown.

For more information about states, see the UIStateContainer overview.

See Also: keyDown

mouseUp

public boolean mouseUp(Event e, int x, int y);

Determines whether the button control's pressed state is set, and if so, generates an action event.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the button control.
x The x coordinate of the event.
y The y coordinate of the event.

Remarks:

The pressed state is set when the mouse button is pressed over the control. When the mouse button is released, mouseUp then clears the pressed state and generates an action event.

setLabel

public void setLabel(String name);

Sets the content of the button to the specified name.

Return Value:

No return value.

ParameterDescription
name The string to be displayed by the button.

setStyle

public void setStyle(int style);

Sets the button's current style.

Return Value:

No return value.

ParameterDescription
style The style of the button. You can pass UIButton.TOGGLE or UIButton.TRITOGGLE, or you can set any bit in the mask 0xFF000000.

Exceptions:

IllegalArgumentException if an undefined style was specified.

See Also: getStyle

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