|
Sleepbot.com Java Classes | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface which defines everything you'll need to create a custom WRLDtime time-piece.
An implementing class can be used by both WRLDtimeApp
and WRLDtimeApplet
.
Depending upon its owner's context, your time-piece will provide Frame or Applet functionality.
In terms of time-keeping and rendering, they'll be largely similar.
The best example of how to provide such an implementation is the WRLDtime
class.
There's also a no-op implementing class; WRLDtimePieceNoOp
.
For more information, please see the general documentation at Sleepbot.com.
version 1.3 - 01Jan05 - Daniel M Foley
version 1.0 - 15Feb98 - Daniel M Foley
Method Summary | |
void |
destroy()
This routine is called by the owner just before it destroys itself. |
void |
init(WRLDcron cron,
java.applet.Applet a)
This routine is called during initialization by an owning applet (eg. WRLDtimeApplet ). |
void |
init(WRLDcron cron,
java.awt.Frame f,
java.lang.String[] args)
This routine is called during initialization by an owning application (eg. WRLDtimeApp ) which has constructed a Frame. |
void |
init(WRLDcron cron,
java.lang.String[] args)
This routine is called during initialization by a simple owning application. |
boolean |
isLoaded()
This routine is called when the owner needs to know if all resources (images, configuration files, etc) have been loaded. |
boolean |
isPaintable()
This routine is called when the owner needs to know if this class is ready to paint itself or not. |
void |
paint(java.awt.Graphics g,
java.awt.Dimension d)
This routine is called when the owner wants you to paint yourself. |
void |
start(WRLDcron cron)
This routine is called by the owner just before its thread starts up. |
void |
stop(WRLDcron cron)
This routine is called by the owner just before its thread stops. |
void |
tick(WRLDcron cron)
This routine is called when the owner's chronometer has been incremented. |
void |
waiting(WRLDcron cron)
This routine is called within the owner's inner time-keeping loop. |
Method Detail |
public void init(WRLDcron cron, java.applet.Applet a)
WRLDtimeApplet
).
init()
routine).
This is a good time to set up instance variables, allocate dynamic storage, etc.
cron
- a WRLDcron
object which is maintained by the owner.a
- the owning Applet
itselfpublic void init(WRLDcron cron, java.awt.Frame f, java.lang.String[] args)
WRLDtimeApp
) which has constructed a Frame.
cron
- a WRLDcron
object which is maintained by the owner.f
- the Frame
into which the time-piece will be renderedargs
- the raw command line arguments from the application, in case you want thempublic void init(WRLDcron cron, java.lang.String[] args)
stdout
.
Even though WRLDtimeNow
does not invoke this method, it's a viable consideration.
cron
- a WRLDcron
object which is maintained by the owner.args
- the raw command line arguments from the application, in case you want thempublic void destroy()
public void start(WRLDcron cron)
after
the appropriate init()
method has completed.
In an application, it is called once, just after start-up.
In an applet, it's called every time you refresh the page.
This is a good time to complete your pre-run preparations.
cron
- a WRLDcron
object which is maintained by the owner.public void stop(WRLDcron cron)
before
the destroy()
method is invoked.
In an application, it's called once, just before termination.
In an applet, it's called every time you refresh the page.
Basically, just stop everything you were doing to keep time.
cron
- a WRLDcron
object which is maintained by the owner.public void waiting(WRLDcron cron)
tick(WRLDcron)
; the owner is just keeping time.
If there's anything you need to do while waiting, here's where to do it.
cron
- a WRLDcron
object which is maintained by the owner.public void tick(WRLDcron cron)
waiting(WRLDcron)
has paid off and there's a new WRLDtime code to be leveraged.
The paint(Graphics, Dimension)
does NOT receive a WRLDcron
object, so this is your opportunity to take a snapshot (eg. WRLDcronTick
) of the current time code.
This is an intentional optimization; paint requests and new time codes are completely asynchronous events.
cron
- a WRLDcron
object which is maintained by the owner.public void paint(java.awt.Graphics g, java.awt.Dimension d)
tick(WRLDcron)
event.
g
- a Graphics
object for drawingd
- the Dimension
of the display areapublic boolean isPaintable()
false
, the owner will display the standard "WRLDtime" logo instead.
true
if this class is ready to handle paint requests, false
otherwisepublic boolean isLoaded()
false
, the owner will perform patient ticks rather than dedicated ones (ie. less accuracy)
That in turn will increase the performance of the loading process.
true
if this class has loaded all of its resources, false
otherwise
|
Sleepbot.com Java Classes | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |