javax.swing.Icon
, AsynchronousLoading
, ResizableIcon
public class DecoratedResizableIcon extends java.lang.Object implements ResizableIcon, AsynchronousLoading
ResizableIcon
that adds decorations to a main icon.Modifier and Type | Class | Description |
---|---|---|
static interface |
DecoratedResizableIcon.IconDecorator |
Icon decorator interface.
|
Modifier and Type | Field | Description |
---|---|---|
protected java.util.List<DecoratedResizableIcon.IconDecorator> |
decorators |
List of icon decorators.
|
protected ResizableIcon |
delegate |
The main delegate icon.
|
Constructor | Description |
---|---|
DecoratedResizableIcon(ResizableIcon delegate) |
Creates a new decorated icon with no decorators.
|
DecoratedResizableIcon(ResizableIcon delegate,
DecoratedResizableIcon.IconDecorator... decorators) |
Creates a new decorated icon.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addAsynchronousLoadListener(AsynchronousLoadListener l) |
Adds listener on the asynchronous loading events.
|
void |
addIconDecorator(DecoratedResizableIcon.IconDecorator decorator) |
Adds the specified decorator to the end of the decorator sequence.
|
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 |
removeIconDecorator(DecoratedResizableIcon.IconDecorator decorator) |
Removes the specified decorator.
|
void |
setDimension(java.awt.Dimension newDimension) |
Changes the dimension of
this icon. |
protected ResizableIcon delegate
protected java.util.List<DecoratedResizableIcon.IconDecorator> decorators
public DecoratedResizableIcon(ResizableIcon delegate, DecoratedResizableIcon.IconDecorator... decorators)
delegate
- The main icon.decorators
- Icon decorators.public DecoratedResizableIcon(ResizableIcon delegate)
addIconDecorator(IconDecorator)
.delegate
- Main 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 setDimension(java.awt.Dimension newDimension)
ResizableIcon
this
icon.setDimension
in interface ResizableIcon
newDimension
- New dimension for this
icon.public void addIconDecorator(DecoratedResizableIcon.IconDecorator decorator)
decorator
- Decorator to add.public void removeIconDecorator(DecoratedResizableIcon.IconDecorator decorator)
decorator
- Decorator to remove.public void addAsynchronousLoadListener(AsynchronousLoadListener l)
AsynchronousLoading
addAsynchronousLoadListener
in interface AsynchronousLoading
l
- Listener to add.public void removeAsynchronousLoadListener(AsynchronousLoadListener l)
AsynchronousLoading
removeAsynchronousLoadListener
in interface AsynchronousLoading
l
- Listener to remove.public boolean isLoading()
AsynchronousLoading
isLoading
in interface AsynchronousLoading
true
if the content is still loading,
false
otherwise.