javax.swing

Interface Icon

public interface Icon

Defines the methods that an object must implement if it should be used as an icon in Swing.
Method Summary
intgetIconHeight()
Returns the height of the icon.
intgetIconWidth()
Returns the width of the icon.
voidpaintIcon(Component c, Graphics g, int x, int y)
Draws the icon at the location (x, y) on the specified graphics device.

Method Detail

getIconHeight

public int getIconHeight()
Returns the height of the icon.

Returns: The height of the icon.

getIconWidth

public int getIconWidth()
Returns the width of the icon.

Returns: The width of the icon.

paintIcon

public void paintIcon(Component c, Graphics g, int x, int y)
Draws the icon at the location (x, y) on the specified graphics device.

Parameters: c a component related to the icon in some way (can be ignored by some implementing classes). g the graphics device. x the x-coordinate. y the y-coordinate.