javax.swing.plaf

Class IconUIResource

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.
Constructor Summary
IconUIResource(Icon delegate)
Constructs a IconUIResource that wraps another icon.
Method Summary
intgetIconHeight()
Returns the height of the icon in pixels.
intgetIconWidth()
Returns the width of the icon in pixels.
voidpaintIcon(Component c, Graphics g, int x, int y)
Paints the icon by asking the delegate icon to paint itself.

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

getIconHeight

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

getIconWidth

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

paintIcon

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

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.