Class UIMarquee
public class UIMarquee extends UIViewer implements
TimerListener
{
// Constructors
public UIMarquee();
public UIMarquee(IUIComponent comp);
public UIMarquee(IUIComponent comp, int rate);
public UIMarquee(IUIComponent comp, int rate, int dx, int dy);
// Methods
public void addNotify();
public boolean ensureVisible(Rectangle rect);
public int getRoleCode();
public int getStateCode();
public void setContent(IUIComponent comp);
public void timeTriggered(TimerEvent te);
}
This class implements a marquee control. By extending UIViewer, UIMarquee displays and moves another component within its content area. By implementing the TimerListener interface, UIMarquee then scrolls this component in a given direction at a fixed rate.
The following example shows how to construct a UIMarquee object.
// Construct a marquee control that displays the text
// "Hello World" and scrolls at a rate of 100 milliseconds.
// By default, this text will scroll from right to left.
UIMarquee m = new UIMarquee(new UIText("Hello World"), 100);
// Now add the marquee to the container.
add(m);
UIComponent
|
+--UIContainer
|
+--UIStateContainer
|
+--UIPanel
|
+--UIViewer
|
+--UIMarquee
public UIMarquee();
Creates a marquee control with no content.
Remarks:
To add content to the control, call setContent. By default, the content component scrolls from right to left at a rate of 75 milliseconds. The component moves by 10 pixels in the horizontal direction and 0 pixels in the vertical direction.
public UIMarquee(IUIComponent comp);
Creates a marquee control with the specified component.
Parameter | Description |
comp
| The component to be displayed within the marquee control.
|
Remarks:
By default, the component scrolls from right to left at a rate of 75 milliseconds. The component moves by 10 pixels in the horizontal direction and 0 pixels in the vertical direction.
public UIMarquee(IUIComponent comp, int rate);
Creates a marquee control with the specified component and rate.
Parameter | Description |
comp
| The component to be displayed within the marquee control.
|
rate
| The rate at which to scroll the component (in milliseconds).
|
Remarks:
By default, the component scrolls from right to left at the specified rate. The component moves by 10 pixels in the horizontal direction and 0 pixels in the vertical direction.
public UIMarquee(IUIComponent comp, int rate, int dx, int dy);
Creates a marquee control with the specified component, rate, and scroll increments.
Parameter | Description |
comp
| The component to be displayed within the marquee control.
|
rate
| The rate at which to scroll the component (in milliseconds).
|
dx
| The horizontal increment for scrolling the component (in pixels).
|
dy
| The vertical increment for scrolling the component (in pixels).
|
Remarks:
If the dx and dy parameters are both nonnegative, the component scrolls from right to left. Otherwise, if either parameter is negative, the component scrolls from left to right.
public void addNotify();
Called to perform initialization when the graphics context is first available.
Return Value:
No return value.
Overrides:
addNotify in UIViewer.
public boolean ensureVisible(Rectangle rect);
Brings the area identified by the specified rectangle into view.
Note This method is currently not implemented.
Return Value:
Returns Returns false.
Parameter | Description |
rect
| The rectangle identifying the area to be made visible.
|
Overrides:
ensureVisible(Rectangle) in UIViewer.
public int getRoleCode();
Retrieves the ROLE_SYSTEM code that best describes the role of the marquee control.
Return Value:
Returns the ROLE_SYSTEM_ANIMATION code.
Overrides:
getRoleCode() in UIViewer.
public int getStateCode();
Retrieves the state of the marquee control.
Return Value:
Returns the combination of STATE_SYSTEM codes that best describe the state of the control.
Remarks:
The returned code contains the STATE_SYSTEM_MARQUEED flag. If either the horizontal scroll increment or vertical scroll increment is nonzero, the code also contains the STATE_SYSTEM_ANIMATED flag.
public void setContent(IUIComponent comp);
Sets the marquee control's content to the specified component.
Return Value:
No return value.
Parameter | Description |
comp
| The component to be displayed within the control.
|
Overrides:
setContent(IUIComponent) in UIViewer.
public void timeTriggered(TimerEvent te);
Scrolls the component within the marquee control.
Return Value:
No return value.
Parameter | Description |
te
| A TimerEvent object that describes the timer event.
|
Remarks:
This method implements timeTriggered in the TimerListener interface. When the marquee control is created, a repeating timer is started. Whenever the timer expires, timeTriggered is invoked to scroll the component within the marquee control.
You can specify the scroll rate and scroll increments in the constructor. By default, the component scrolls from right to left at a rate of 75 milliseconds. The component moves by 10 pixels in the horizontal direction and 0 pixels in the vertical direction.
Note If you extend your own class from UIMarquee and implement the TimerListener interface, be sure to call the super method TimerListener(event).
Overrides:
timeTriggered(TimerEvent) in UIViewer.
See Also: com.ms.util.TimerListener