org.openbp.common.icon
Class OverlayIcon

java.lang.Object
  extended by javax.swing.ImageIcon
      extended by org.openbp.common.icon.MultiImageIcon
          extended by org.openbp.common.icon.OverlayIcon
All Implemented Interfaces:
java.io.Serializable, javax.accessibility.Accessible, javax.swing.Icon, FlexibleSize, MultiIcon

public class OverlayIcon
extends MultiImageIcon

Icon that can be placed over an existing icon. This class is usally used in accordance with the flyweight pattern, i.e. one instance is used for multiple icons.

Author:
Stephan Moritz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.ImageIcon
javax.swing.ImageIcon.AccessibleImageIcon
 
Field Summary
 
Fields inherited from class javax.swing.ImageIcon
component, tracker
 
Fields inherited from interface org.openbp.common.icon.FlexibleSize
HUGE, LARGE, MEDIUM, SMALL, STANDARD, UNDETERMINED
 
Constructor Summary
OverlayIcon(MultiImageIcon master)
          Creates a new OverlayIcon with master out of master.
 
Method Summary
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
          Paints first the background and the overlay on top of each other.
 OverlayIcon setBackground(javax.swing.Icon background)
          Sets the background.
 
Methods inherited from class org.openbp.common.icon.MultiImageIcon
getIcon, getIconHeight, getIconSize, getIconWidth, getImage, setIconSize
 
Methods inherited from class javax.swing.ImageIcon
getAccessibleContext, getDescription, getImageLoadStatus, getImageObserver, loadImage, setDescription, setImage, setImageObserver, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OverlayIcon

public OverlayIcon(MultiImageIcon master)
Creates a new OverlayIcon with master out of master.

Parameters:
master - The icon that should be the master of this overlay icon
Method Detail

setBackground

public OverlayIcon setBackground(javax.swing.Icon background)
Sets the background.

Parameters:
background - The background to set
Returns:
The changed OverlayIcon

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Paints first the background and the overlay on top of each other.

Specified by:
paintIcon in interface javax.swing.Icon
Overrides:
paintIcon in class MultiImageIcon
Parameters:
c - The component to paint on
g - The graphics object to be used for painting
x - The x coordinate where the icon should be painted
y - The y coordinate where the icon should be painted
See Also:
Icon.paintIcon(Component, Graphics, int, int)


Copyright © 2011. All Rights Reserved.