JHotDraw 7.4.1

org.jhotdraw.gui.plaf.palette
Class MultiIcon

java.lang.Object
  extended by org.jhotdraw.gui.plaf.palette.MultiIcon
All Implemented Interfaces:
javax.swing.Icon
Direct Known Subclasses:
SliderThumbIcon

public abstract class MultiIcon
extends java.lang.Object
implements javax.swing.Icon

An icon which paints one out of multiple icons depending on the state of the component. MultiIcon can lazily create the icons from a tiled image.

Version:
$Id: MultiIcon.java 527 2009-06-07 14:28:19Z rawcoder $
Author:
Werner Randelshofer

Field Summary
protected  javax.swing.Icon[] icons
          The icons from which we choose from.
 
Constructor Summary
MultiIcon(javax.swing.Icon[] icons)
          Creates a new instance from an array of icons.
MultiIcon(java.awt.Image[] images)
          Creates a new instance from an array of images.
MultiIcon(java.awt.Image tiledImage, int tileCount, boolean isTiledHorizontaly)
          Creates a new instance.
 
Method Summary
protected abstract  void generateMissingIcons()
           
protected abstract  javax.swing.Icon getIcon(java.awt.Component c)
           
 int getIconHeight()
           
 int getIconWidth()
           
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

icons

protected javax.swing.Icon[] icons
The icons from which we choose from. This variable is null, if we are using a tiled image as our base.

Constructor Detail

MultiIcon

public MultiIcon(javax.swing.Icon[] icons)
Creates a new instance from an array of icons. All icons must have the same dimensions. If an icon is null, an icon is derived for the state from the other icons.


MultiIcon

public MultiIcon(java.awt.Image[] images)
Creates a new instance from an array of images. All icons must have the same dimensions. If an icon is null, an icon is derived for the state from the other icons.


MultiIcon

public MultiIcon(java.awt.Image tiledImage,
                 int tileCount,
                 boolean isTiledHorizontaly)
Creates a new instance. The icon representations are created lazily from the tiled image.

Method Detail

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface javax.swing.Icon

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface javax.swing.Icon

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface javax.swing.Icon

getIcon

protected abstract javax.swing.Icon getIcon(java.awt.Component c)

generateMissingIcons

protected abstract void generateMissingIcons()

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.