Groovy Documentation

com.wordpress.tipsforjava.swing
[Java] Class CircularAnimatedIcon

java.lang.Object
  com.wordpress.tipsforjava.swing.AnimatedIcon
      com.wordpress.tipsforjava.swing.CircularAnimatedIcon

public class CircularAnimatedIcon
extends AnimatedIcon

The CircularAnimatedIcon will display a series of Icons in a circular sequence. That is, the cycle will be completed when the Icons have been displayed from first to last and then back down to the first again.

Authors:
Rob Camick
Darryl Burke


Field Summary
private int direction

 
Fields inherited from class AnimatedIcon
BOTTOM, CENTER, DEFAULT_CYCLES, DEFAULT_DELAY, LEFT, RIGHT, TOP, alignmentX, alignmentY, animationFinished, component, currentIconIndex, cycles, cyclesCompleted, iconHeight, iconWidth, iconX, iconY, icons, showFirstIcon, timer
 
Constructor Summary
CircularAnimatedIcon(JComponent component, Icon... icons)

Create a CircularAnimatedIcon that will continuously cycle with the default delay (500ms).

CircularAnimatedIcon(JComponent component, int delay, Icon... icons)

Create an CircularAnimatedIcon that will continuously cycle

CircularAnimatedIcon(JComponent component, int delay, int cycles, Icon... icons)

Create an CircularAnimatedIcon specifying all the properties.

 
Method Summary
protected int getNextIconIndex(int currentIndex, int iconCount)

Get the index of the next Icon to be displayed.

protected boolean isCycleCompleted(int currentIndex, int iconCount)

This implemention checks if the first icon is currently displayed.

 
Methods inherited from class AnimatedIcon
actionPerformed, addIcon, calculateIconDimensions, getAlignmentX, getAlignmentY, getComponent, getCurrentIconIndex, getCycles, getDelay, getIcon, getIconCount, getIconHeight, getIconWidth, getNextIconIndex, getOffset, isCycleCompleted, isShowFirstIcon, paintIcon, pause, restart, run, setAlignmentX, setAlignmentY, setCurrentIconIndex, setCycles, setDelay, setShowFirstIcon, start, stop
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

direction

private int direction


 
Constructor Detail

CircularAnimatedIcon

public CircularAnimatedIcon(JComponent component, Icon... icons)
Create a CircularAnimatedIcon that will continuously cycle with the default delay (500ms).
Parameters:
component - the component the icon will be painted on
icons - the Icons to be painted as part of the animation


CircularAnimatedIcon

public CircularAnimatedIcon(JComponent component, int delay, Icon... icons)
Create an CircularAnimatedIcon that will continuously cycle
Parameters:
component - the component the icon will be painted on
delay - the delay between painting each icon, in milli seconds
icons - the Icons to be painted as part of the animation


CircularAnimatedIcon

public CircularAnimatedIcon(JComponent component, int delay, int cycles, Icon... icons)
Create an CircularAnimatedIcon specifying all the properties.
Parameters:
component - the component the icon will be painted on
delay - the delay between painting each icon, in milli seconds
cycles - the number of times to repeat the animation sequence
icons - the Icons to be painted as part of the animation


 
Method Detail

getNextIconIndex

protected int getNextIconIndex(int currentIndex, int iconCount)
Get the index of the next Icon to be displayed. The cycle starts at the first Icon, continues to the last and then continues back down to the first.
Parameters:
index - the index of the Icon currently displayed
iconCount - the number of Icons to be displayed
Returns:
the index of the next Icon to be displayed


isCycleCompleted

protected boolean isCycleCompleted(int currentIndex, int iconCount)
This implemention checks if the first icon is currently displayed. If so this indicates all icons have been displayed in a forwards and reverse order so the cycle is complete.
Parameters:
index - the index of the Icon currently displayed
iconCount - the number of Icons to be displayed
Returns:
the index of the next Icon to be displayed


 

Groovy Documentation