com.borland.primetime.ui
Class ImageListIcon

java.lang.Object
  |
  +--com.borland.primetime.ui.ImageListIcon
All Implemented Interfaces:
javax.swing.Icon

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

An ImageListIcon provides a convenient mechanism for loading a single icon among many of the same size (all of an identical height and width) which are arranged as one horizontal strip in the composite "list" image.


Constructor Summary
ImageListIcon(java.awt.Image image, int iconSize, int index)
          Creates an ImageListIcon whose contents are derived from the specified image using the specified icon size and the offset within the strip of icons.
 
Method Summary
 int getIconHeight()
          Override to return height from size given in constructor.
 int getIconWidth()
          Override to return width from size given in constructor.
 java.awt.Image getImage()
          Returns Image passed on constructor.
 int getIndex()
          Returns index passed on constructor.
 int getOffset()
          Returns offset calculated from index and width of each icon.
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
          Override to paint the defined icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageListIcon

public ImageListIcon(java.awt.Image image,
                     int iconSize,
                     int index)
Creates an ImageListIcon whose contents are derived from the specified image using the specified icon size and the offset within the strip of icons.
Parameters:
image - The underlying image which is a horizontal strip of icons.
iconSize - The size in pixels which is the width and height of each icon.
index - The zero-based index of the desired icon.
Method Detail

getImage

public java.awt.Image getImage()
Returns Image passed on constructor.
Returns:
Image from constructor.

getIndex

public int getIndex()
Returns index passed on constructor.
Returns:
Index from constructor.

getOffset

public int getOffset()
Returns offset calculated from index and width of each icon.
Returns:
Calculated offset given index and icon size information.

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Override to paint the defined icon.
Specified by:
paintIcon in interface javax.swing.Icon
Parameters:
c - Component to paint.
g - Graphics object to paint with.
x - Left coordinate.
y - Top coordinate.

getIconWidth

public int getIconWidth()
Override to return width from size given in constructor.
Specified by:
getIconWidth in interface javax.swing.Icon

getIconHeight

public int getIconHeight()
Override to return height from size given in constructor.
Specified by:
getIconHeight in interface javax.swing.Icon