Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIRepeatButton

public class UIRepeatButton extends UIPushButton implements 
            TimerListener
{
  // Constructors
  public UIRepeatButton();
  public UIRepeatButton(String text);
  public UIRepeatButton(String text, int style);
  public UIRepeatButton(IUIComponent comp);
  public UIRepeatButton(IUIComponent comp, int style);

  // Methods
  public boolean mouseClicked(Event e, int x, int y);
  public void setPressed(boolean on);
  public void timeTriggered(TimerEvent te);
}

This class implements a repeating push button control. When a UIRepeatButton object is pressed, action events are continually generated as long as the button remains pressed. (With a UIPushButton object, an action event is generated when the button is pressed and released.)

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

Constructors

UIRepeatButton

public UIRepeatButton();

Creates a repeating push button control with no content.

Remarks:

By default, the button has a flat style.

UIRepeatButton

public UIRepeatButton(String text);

Creates a repeating 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.

UIRepeatButton

public UIRepeatButton(String text, int style);

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

ParameterDescription
text The text to be displayed within 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.

UIRepeatButton

public UIRepeatButton(IUIComponent comp);

Creates a repeating 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 has a flat style. For examples of how to construct buttons, see the UIButton overview.

UIRepeatButton

public UIRepeatButton(IUIComponent comp, int style);

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

ParameterDescription
comp The component to be displayed within 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

mouseClicked

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

Responds to the mouse button being clicked over the control.

Return Value:

Returns false.

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

setPressed

public void setPressed(boolean on);

Sets or clears the pressed state of the button. As long as the button remains in the pressed state, action events are continually generated.

Return Value:

No return value.

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

Remarks:

This method is automatically invoked when the mouse button is pressed over the control. setPressed lays out and redraws the button to display the new state. If the on parameter is true, a repeating timer is started. Whenever the timer expires, timeTriggered is invoked to generate an action event. If on is false, the timer is stopped.

For more information about states, see the UIStateContainer overview.

Overrides:

setPressed(boolean) in UIPushButton.

timeTriggered

public void timeTriggered(TimerEvent te);

Posts an action event to the button.

Return Value:

No return value.

ParameterDescription
te A TimerEvent object that describes the timer event.

Remarks:

This method implements timeTriggered in the TimerListener interface. The setPressed method starts a repeating timer. Whenever the timer expires, timeTriggered is automatically invoked to generate an action event. As long as the button remains pressed, actions events are continually generated.

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