javax.swing.plaf
Class IconUIResource

java.lang.Object
  extended by javax.swing.plaf.IconUIResource
All Implemented Interfaces:
Serializable, Icon, UIResource

public class IconUIResource
extends Object
implements Icon, UIResource, Serializable

An icon that is marked as UIResource, which indicates that it has been installed by a pluggable LookAndFeel. Such icons are replaced when the LookAndFeel changes.

See Also:
Serialized Form

Constructor Summary
IconUIResource(Icon delegate)
          Constructs a IconUIResource that wraps another icon.
 
Method Summary
 int getIconHeight()
          Returns the height of the icon in pixels.
 int getIconWidth()
          Returns the width of the icon in pixels.
 void paintIcon(Component c, Graphics g, int x, int y)
          Paints the icon by asking the delegate icon to paint itself.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconUIResource

public IconUIResource(Icon delegate)
Constructs a IconUIResource that wraps another icon. All messages are forwarded to the delegate icon.

Parameters:
delegate - the icon that is wrapped by this IconUIResource (null not permitted).
Method Detail

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Paints the icon by asking the delegate icon to paint itself.

Specified by:
paintIcon in interface Icon
Parameters:
c - the Component whose icon is being painted. Some icons use this argument to retrieve properties like the background color.
g - the graphics into which the icon will be painted.
x - the horizontal position of the icon.
y - the vertical position of the icon.

getIconWidth

public int getIconWidth()
Returns the width of the icon in pixels. The implementation determines and returns the width of the delegate icon.

Specified by:
getIconWidth in interface Icon
Returns:
The width of the icon.

getIconHeight

public int getIconHeight()
Returns the height of the icon in pixels. The implementation determines and returns the height of the delegate icon.

Specified by:
getIconHeight in interface Icon
Returns:
The height of the icon.