org.jdesktop.jdic.screensaver
Class SimpleScreensaver

java.lang.Object
  extended by org.jdesktop.jdic.screensaver.ScreensaverBase
      extended by org.jdesktop.jdic.screensaver.SimpleScreensaver
Direct Known Subclasses:
BouncingLine, Test1, Test2, WebStartScreenSaver

public abstract class SimpleScreensaver
extends ScreensaverBase

Base class for simple screensavers who will have their paint() method invoked on a regular basis to render each frame.

Author:
Mark Roth

Constructor Summary
SimpleScreensaver()
           
 
Method Summary
abstract  void paint(java.awt.Graphics g)
          Override this method in your subclasses to paint a single frame.
 void renderFrame()
          Called by the native layer to render the next frame.
 
Methods inherited from class org.jdesktop.jdic.screensaver.ScreensaverBase
baseDestroy, baseInit, getContext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleScreensaver

public SimpleScreensaver()
Method Detail

paint

public abstract void paint(java.awt.Graphics g)
Override this method in your subclasses to paint a single frame. Any exceptions thrown during paint will be sent to the org.jdesktop.jdic.screensaver J2SE logger.

Tip: Treat this as though it were part of a game loop. In general, it's a good idea not to allocate ('new') any objects after init unless they will not be deleted. This will yield smoother animation and no pauses from the garbage collector.

Parameters:
g - Graphics context used to draw to the screensaver window.

renderFrame

public final void renderFrame()
Called by the native layer to render the next frame.

Overrides:
renderFrame in class ScreensaverBase