javax.swing
Interface Icon

All Known Implementing Classes:
IconUIResource, ImageIcon, MetalCheckBoxIcon, MetalComboBoxIcon, MetalIconFactory.FileIcon16, MetalIconFactory.FolderIcon16, MetalIconFactory.PaletteCloseIcon, MetalIconFactory.TreeControlIcon, MetalIconFactory.TreeFolderIcon, MetalIconFactory.TreeLeafIcon

public interface Icon

Defines the methods that an object must implement if it should be used as an icon in Swing.


Method Summary
 int getIconHeight()
          Returns the height of the icon.
 int getIconWidth()
          Returns the width of the icon.
 void paintIcon(Component c, Graphics g, int x, int y)
          Draws the icon at the location (x, y) on the specified graphics device.
 

Method Detail

getIconHeight

int getIconHeight()
Returns the height of the icon.

Returns:
The height of the icon.

getIconWidth

int getIconWidth()
Returns the width of the icon.

Returns:
The width of the icon.

paintIcon

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.