T
- enumeration key into the deckpublic class IconDeckResizableIcon<T> extends java.lang.Object implements ResizableIcon, AsynchronousLoading
ResizableIcon
that allows switching the icon
painting at runtime. This class can be used as a delegate in the
DecoratedResizableIcon
where the "base" icon is changed at runtime
without the need to recompute all the decorators.Constructor and Description |
---|
IconDeckResizableIcon(java.util.Map<T,? extends ResizableIcon> iconDeck)
Creates the icon deck.
|
Modifier and Type | Method and Description |
---|---|
void |
addAsynchronousLoadListener(AsynchronousLoadListener l)
Adds listener on the asynchronous loading events.
|
int |
getIconHeight() |
int |
getIconWidth() |
boolean |
isLoading()
Returns indication whether the content is still loading.
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y) |
void |
removeAsynchronousLoadListener(AsynchronousLoadListener l)
Removes listener on the asynchronous loading events.
|
void |
setDimension(java.awt.Dimension dim)
Changes the dimension of
this icon. |
void |
setIcon(T key)
Sets the currently shown icon.
|
public IconDeckResizableIcon(java.util.Map<T,? extends ResizableIcon> iconDeck)
iconDeck
- Icon deck.public void setIcon(T key)
key
- Icon key.public void setDimension(java.awt.Dimension dim)
ResizableIcon
this
icon.setDimension
in interface ResizableIcon
dim
- New dimension for this
icon.public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
public void addAsynchronousLoadListener(AsynchronousLoadListener l)
AsynchronousLoading
addAsynchronousLoadListener
in interface AsynchronousLoading
l
- Listener to add.public boolean isLoading()
AsynchronousLoading
isLoading
in interface AsynchronousLoading
true
if the content is still loading,
false
otherwise.public void removeAsynchronousLoadListener(AsynchronousLoadListener l)
AsynchronousLoading
removeAsynchronousLoadListener
in interface AsynchronousLoading
l
- Listener to remove.