Package edu.cnu.mdi.component
Class DrawnComponentManager
java.lang.Object
edu.cnu.mdi.component.DrawnComponentManager
Shared animation manager for drawn buttons.
The manager owns one Swing Timer. Animated buttons register when they become
displayable and unregister when removed from the Swing hierarchy. The timer stops when
no animated buttons remain.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMilliseconds between animation frames, roughly 30 frames per second. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of elapsed animation frames.static DrawnComponentManagerReturns the shared animation manager.voidregister(AbstractButton button) Registers a button for animation repainting.voidunregister(AbstractButton button) Unregisters a button from animation repainting.
-
Field Details
-
DEFAULT_DELAY
public static final int DEFAULT_DELAYMilliseconds between animation frames, roughly 30 frames per second.- See Also:
-
-
Method Details
-
getInstance
Returns the shared animation manager.- Returns:
- the singleton manager
-
register
Registers a button for animation repainting.- Parameters:
button- the button to repaint on animation frames
-
unregister
Unregisters a button from animation repainting.- Parameters:
button- the button to unregister
-
getFrameCount
public long getFrameCount()Returns the number of elapsed animation frames.- Returns:
- the current frame count
-