public abstract class FrameInterval extends Object implements FrameParticipant
| Constructor and Description |
|---|
FrameInterval(FrameManager mgr)
Constructor - registers the interval as a frame participant
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel the current schedule, and ensure that any expirations that
are queued up but have not yet run do not run.
|
abstract void |
expired()
The main method where your interval should do its work.
|
Component |
getComponent()
If a frame participant wishes also to be actively rendered every
frame rather than use passive rendering (which for Swing, at least,
is hijacked when using the frame manager such that we take care of
repainting dirty Swing components every frame into our off-screen
buffer), it can return a component here which will have
Component.paint(java.awt.Graphics) called on it once per frame with a translated but
unclipped graphics object. |
boolean |
needsPaint()
Called immediately prior to
FrameParticipant.getComponent() and then Component.paint(java.awt.Graphics) on said component, to determine whether or not
this frame participant needs to be painted. |
void |
schedule(long delay)
Schedule the interval to execute once, after the specified delay.
|
void |
schedule(long delay,
boolean repeat)
Schedule the interval to execute repeatedly, with the same delay.
|
void |
schedule(long initialDelay,
long repeatDelay)
Schedule the interval to execute repeatedly with the specified
initial delay and repeat delay.
|
void |
tick(long tickStamp)
This is called on all registered frame participants, one for every
frame.
|
public FrameInterval(FrameManager mgr)
public Component getComponent()
FrameParticipantComponent.paint(java.awt.Graphics) called on it once per frame with a translated but
unclipped graphics object.
Because clipping is expensive in terms of rectangle object allocation, frame participants are given the opportunity to do their own clipping because they are likely to want to clip to a more fine grained region than their entire bounds. If a participant does not wish to be actively rendered, it can safely return null.
getComponent in interface FrameParticipantpublic boolean needsPaint()
FrameParticipantFrameParticipant.getComponent() and then Component.paint(java.awt.Graphics) on said component, to determine whether or not
this frame participant needs to be painted.needsPaint in interface FrameParticipantpublic void tick(long tickStamp)
FrameParticipanttick in interface FrameParticipantpublic abstract void expired()
public final void schedule(long delay)
public final void schedule(long delay,
boolean repeat)
public final void schedule(long initialDelay,
long repeatDelay)
public final void cancel()
Copyright © 2015. All rights reserved.