All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.awt.Pinwheel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----com.sun.wizards.awt.Pinwheel

public class Pinwheel
extends Component
implements Runnable
The Pinwheel component is an indicator that runs in its own thread. This component is used to indicate the program is busy (doing something that is difficult to calculate progress for).

The Pinwheel component appears to spin until the stop method is called.

Graphic of Pinwheel at its default size.

Here is the code for this applet:


 import java.applet.Applet;
 import java.awt.*;
 import com.sun.wizards.awt.*;
 public class Test extends Applet
 {
   public void init()
     {
       setLayout(new GridBagLayout());
       add(new Pinwheel());
     }
 }
 


Variable Index

 o framesPerRevolution
The number of frames in a cycle.
 o sectionCount
The number of sections in the pinwheel.
 o updateRate
The image update rate (fps).

Constructor Index

 o Pinwheel()
Creates a Pinwheel component that updates 5 times per second and has 4 sections.
 o Pinwheel(int)
Creates a Pinwheel that updates the specified number of images per second and has 4 sections.
 o Pinwheel(int, int)
Creates a Pinwheel that updates the specified number of images per second with the specified number of sections.
 o Pinwheel(int, int, int)
Creates a Pinwheel that updates the specified number of images per second with the specified number of sections.

Method Index

 o createImage(int)
Creates the specified image.
 o displayImage(int)
Displays the specified image.
 o getMinimumSize()
Gets the minimum size of this component.
 o getPreferredSize()
Gets the preferred size of this component.
 o paint(Graphics)
The paint method draws the pinwheel.
 o run()
This thread is responsible for creating the pinwheel animation images and displaying them at the rate specified at initialization time.
 o stop()
Stop the animation thread.

Variables

 o updateRate
 protected int updateRate
The image update rate (fps).

 o sectionCount
 protected int sectionCount
The number of sections in the pinwheel.

 o framesPerRevolution
 protected int framesPerRevolution
The number of frames in a cycle.

Constructors

 o Pinwheel
 public Pinwheel()
Creates a Pinwheel component that updates 5 times per second and has 4 sections.

 o Pinwheel
 public Pinwheel(int updateRate)
Creates a Pinwheel that updates the specified number of images per second and has 4 sections.

Parameters:
updateRate - The number of updates per second.
 o Pinwheel
 public Pinwheel(int updateRate,
                 int sectionCount)
Creates a Pinwheel that updates the specified number of images per second with the specified number of sections.

Parameters:
updateRate - The number of updates per second.
sectionCount - The number of sections in the pinwheel.
 o Pinwheel
 public Pinwheel(int updateRate,
                 int sectionCount,
                 int framesPerRevolution)
Creates a Pinwheel that updates the specified number of images per second with the specified number of sections.

Parameters:
updateRate - The number of updates per second.
sectionCount - The number of sections in the pinwheel.
framesPerRevolution - The number of frames per revolution.

Methods

 o getPreferredSize
 public Dimension getPreferredSize()
Gets the preferred size of this component.

Returns:
A dimension object indicating this component's preferred size.
Overrides:
getPreferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Gets the minimum size of this component.

Returns:
A dimension object indicating this component's minimum size.
Overrides:
getMinimumSize in class Component
 o createImage
 protected Image createImage(int imageNumber)
Creates the specified image.

Parameters:
imageNumber - The index of the image that should be created.
 o displayImage
 protected void displayImage(int imageNumber)
Displays the specified image.

Parameters:
imageNumber - The index of the image to be displayed.
 o run
 public void run()
This thread is responsible for creating the pinwheel animation images and displaying them at the rate specified at initialization time.

 o stop
 public synchronized void stop()
Stop the animation thread.

 o paint
 public void paint(Graphics g)
The paint method draws the pinwheel.

Overrides:
paint in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index