Class SpiroAnim
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----SpiroAnim
- public class SpiroAnim
- extends Canvas
- implements Runnable, WindowListener
SpiroAnim - a class that produces an animated spirograph. SpiroAnim
is an ideal component for entertaining users waiting for
downloading applications. You can add it to any Container and an
animation of a spirograph starts. It's thread has minimum priority.
You can configure the component to stop and start or to reset when
clicked.
If you like this class, feel free to use it. I'd like to hear
how you like it, so don't hesitate to inform me if you use it.
- Version:
- 1.00
- Author:
- Jos van den
Oever
- SpiroAnim()
- Constructs a SpiroAnim with 100 lines per frame.
- SpiroAnim(boolean)
- Constructs a SpiroAnim with 100 lines per frame.
- SpiroAnim(int)
- Constructs a SpiroAnim with the specified number of lines per
frame.
- SpiroAnim(int,
boolean)
- Constructs a SpiroAnim with the specified number of lines per
frame.
- addNotify()
- Notifies the component it has been added to a Container.
- invalidate()
- Invalidate the component.
- paint(Graphics)
- The paint method draws the spirograph using double
buffering.
- processComponentEvent(ComponentEvent)
- Processes ComponentEvents concerning this component.
- processMouseEvent(MouseEvent)
- Processes MouseEvents concerning this component.
- removeNotify()
- Notifies the component is has been removed from a
component.
- reset()
- Resets the animation.
- run()
- Called when the animation is started.
- start()
- Starts the animation.
- stop()
- Stops the animation.
- update(Graphics)
- Update method, calls paint().
- validate()
- Validate the component.
- windowActivated(WindowEvent)
- Unused WindowListener interface function.
- windowClosed(WindowEvent)
- Unused WindowListener interface function.
- windowClosing(WindowEvent)
- Unused WindowListener interface function.
- windowDeactivated(WindowEvent)
- Unused WindowListener interface function.
- windowDeiconified(WindowEvent)
- Function handles deiconification of parent window to start
animation.
- windowIconified(WindowEvent)
- Function handles iconification of parent window to stop
animation.
- windowOpened(WindowEvent)
- Unused WindowListener interface function.
SpiroAnim
public SpiroAnim()
- Constructs a SpiroAnim with 100 lines per frame.
SpiroAnim
public SpiroAnim(boolean mouseUpStopsAnimation)
- Constructs a SpiroAnim with 100 lines per frame.
-
- Parameters:
- mouseUpStopsAnimation - if true the animation stops when
clicked else resets when clicked
SpiroAnim
public SpiroAnim(int I)
- Constructs a SpiroAnim with the specified number of lines per
frame.
-
- Parameters:
- I - the number of lines per frame
SpiroAnim
public SpiroAnim(int I,
boolean mouseUpStopsAnimation)
- Constructs a SpiroAnim with the specified number of lines per
frame.
-
- Parameters:
- I - the number of lines per frame
- mouseUpStopsAnimation - if true the animation stops when
clicked else resets when clicked
start
public void start()
- Starts the animation.
stop
public void stop()
- Stops the animation.
run
public void run()
- Called when the animation is started. Shouldn't be called by
user.
update
public void update(Graphics g)
- Update method, calls paint().
-
- Parameters:
- g - the graphics object on which is to be drawn
- Overrides:
-
update in class Component
paint
public void paint(Graphics g)
- The paint method draws the spirograph using double
buffering.
-
- Parameters:
- g - the graphics object on which is to be drawn
- Overrides:
-
paint in class Canvas
reset
public void reset()
- Resets the animation.
invalidate
public void invalidate()
- Invalidate the component. Shouldn't be called by user.
-
- Overrides:
-
invalidate in class Component
validate
public void validate()
- Validate the component. Is called by the system before the
component is painted, if it has been invalidated. Shouldn't be
called by user.
-
- Overrides:
-
validate in class Component
addNotify
public void addNotify()
- Notifies the component it has been added to a Container.
Shouldn't be called by user.
-
- Overrides:
-
addNotify in class Canvas
removeNotify
public void removeNotify()
- Notifies the component is has been removed from a component.
Shouldn't be called by user.
-
- Overrides:
-
removeNotify in class Component
processComponentEvent
protected void processComponentEvent(ComponentEvent e)
- Processes ComponentEvents concerning this component. Deals with
showing and hiding this component. The SpiroAnim doesn't animate
when hidden to save cpu time.
-
- Parameters:
- e - The ComponentEvent to be handled.
- Overrides:
-
processComponentEvent in class Component
processMouseEvent
protected void processMouseEvent(MouseEvent e)
- Processes MouseEvents concerning this component. Deals with
mouse clicking on this component. The animation starts/stops or
resets on mouse click according to configuration.
-
- Parameters:
- e - The MouseEvent to be handled.
- Overrides:
-
processMouseEvent in class Component
windowOpened
public void windowOpened(WindowEvent e)
- Unused WindowListener interface function.
-
- Parameters:
- e - The WindowEvent to be handled.
windowClosing
public void windowClosing(WindowEvent e)
- Unused WindowListener interface function.
-
- Parameters:
- e - The WindowEvent to be handled.
windowClosed
public void windowClosed(WindowEvent e)
- Unused WindowListener interface function.
-
- Parameters:
- e - The WindowEvent to be handled.
windowIconified
public void windowIconified(WindowEvent e)
- Function handles iconification of parent window to stop
animation. This save cpu time.
-
- Parameters:
- e - The WindowEvent to be handled.
windowDeiconified
public void windowDeiconified(WindowEvent e)
- Function handles deiconification of parent window to start
animation.
-
- Parameters:
- e - The WindowEvent to be handled.
windowActivated
public void windowActivated(WindowEvent e)
- Unused WindowListener interface function.
-
- Parameters:
- e - The WindowEvent to be handled.
windowDeactivated
public void windowDeactivated(WindowEvent e)
- Unused WindowListener interface function.
-
- Parameters:
- e - The WindowEvent to be handled.