anl.aida.palette
Class PaletteIcon

java.lang.Object
  extended by anl.aida.palette.PaletteIcon
All Implemented Interfaces:
javax.swing.Icon

public class PaletteIcon
extends java.lang.Object
implements javax.swing.Icon

Version:
$Revision$ $Date$

Nested Class Summary
static class PaletteIcon.Orientation
           
 
Field Summary
private  int height
           
private  SquareIcon[] icons
           
private  int iconSize
           
private  PaletteIcon.Orientation orientation
           
private  int width
           
 
Constructor Summary
PaletteIcon(Palette palette, PaletteIcon.Orientation orientation)
           
PaletteIcon(SquareIcon[] icons, PaletteIcon.Orientation orientation)
           
 
Method Summary
 java.awt.Color getColorAt(int x, int y)
           
 int getColorIndexAt(int x, int y)
           
 int getIconHeight()
          Returns the icon's height.
 int getIconWidth()
          Returns the icon's width.
private  void init(SquareIcon[] icons, PaletteIcon.Orientation orientation)
           
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
          Draw the icon at the specified location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

icons

private SquareIcon[] icons

orientation

private PaletteIcon.Orientation orientation

width

private int width

height

private int height

iconSize

private int iconSize
Constructor Detail

PaletteIcon

public PaletteIcon(Palette palette,
                   PaletteIcon.Orientation orientation)

PaletteIcon

public PaletteIcon(SquareIcon[] icons,
                   PaletteIcon.Orientation orientation)
Method Detail

getColorAt

public java.awt.Color getColorAt(int x,
                                 int y)

getColorIndexAt

public int getColorIndexAt(int x,
                           int y)

init

private void init(SquareIcon[] icons,
                  PaletteIcon.Orientation orientation)

getIconHeight

public int getIconHeight()
Returns the icon's height.

Specified by:
getIconHeight in interface javax.swing.Icon
Returns:
an int specifying the fixed height of the icon.

getIconWidth

public int getIconWidth()
Returns the icon's width.

Specified by:
getIconWidth in interface javax.swing.Icon
Returns:
an int specifying the fixed width of the icon.

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Draw the icon at the specified location. Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.

Specified by:
paintIcon in interface javax.swing.Icon