|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgraph.example.JGraphAbstractIconAnimator
public abstract class JGraphAbstractIconAnimator
Provides animated ImageIcon
s for Component
s which
have CellRenderer-like functionality. Ordinarily, you'd get no animation with
ordinary TreeCellRenderer
or
TableCellRenderer
since a single component is used
to paint multiple locations on the Component
. Animated icons
must be tracked independently, one per animated cell. This class provides for
maintaining a number of independently animated icons for a given
Component
context. A key must be provided which must be unique across
all elements of substructure (a table might provide "row x col", while a tree
might provide the actual value in a row).
Subclasses should be instantiated near the Component
context
and override the getRepaintRect(Component,Object)
method to trigger
a refresh of its corresponding Component
substructure
location.
Subclasses should take care to invoke stop()
when you want to stop
the animation on a particular location.
This class assumes that all operations will take place on the event dispatch thread, thus there is no class-level synchronization.
TreeCellRenderer
,
DefaultTreeCellRenderer
,
TableCellRenderer
,
DefaultTableCellRenderer
Constructor Summary | |
---|---|
JGraphAbstractIconAnimator(java.awt.Component context,
java.lang.Object key,
javax.swing.ImageIcon icon)
Create an object to animate icon on the given
Component at the substructure location represented by the
key . |
Method Summary | |
---|---|
static JGraphAbstractIconAnimator |
get(java.awt.Component context,
java.lang.Object key)
Return any existing, cached animator for the given context/key, or null if there is none. |
javax.swing.Icon |
getIcon()
Returns the icon to be used for the renderer corresponding to this AbstractIconAnimator . |
abstract java.awt.Rectangle |
getRepaintRect(java.awt.Component context,
java.lang.Object key)
Based on the Component context and key, return the
Component -relative rectangle to be repainted. |
static boolean |
isAnimated(javax.swing.Icon icon)
Return whether the given icon is animated. |
void |
stop()
Stop animating this instance of AbstractIconAnimator . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JGraphAbstractIconAnimator(java.awt.Component context, java.lang.Object key, javax.swing.ImageIcon icon)
icon
on the given
Component
at the substructure location represented by the
key
.
context
- Component on which the animation is to be paintedkey
- Substructure location identifiericon
- The animated iconMethod Detail |
---|
public static boolean isAnimated(javax.swing.Icon icon)
public static JGraphAbstractIconAnimator get(java.awt.Component context, java.lang.Object key)
null
if there is none.
public abstract java.awt.Rectangle getRepaintRect(java.awt.Component context, java.lang.Object key)
Component
context and key, return the
Component
-relative rectangle to be repainted.
public void stop()
AbstractIconAnimator
.
public javax.swing.Icon getIcon()
AbstractIconAnimator
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |