nl.lxtreme.ols.util.swing.component.icon
Class TextOverlayIcon

java.lang.Object
  extended by javax.swing.ImageIcon
      extended by nl.lxtreme.ols.util.swing.component.icon.TextOverlayIcon
All Implemented Interfaces:
Serializable, Accessible, Icon

public class TextOverlayIcon
extends ImageIcon

Provides an icon which takes another icon and renders a given text over it.

Note: it appears that you need to extend ImageIcon in order to have Swing render "disabled" (= grayed out) versions of this icon. There is no other reason to do this.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.ImageIcon
ImageIcon.AccessibleImageIcon
 
Field Summary
 
Fields inherited from class javax.swing.ImageIcon
component, tracker
 
Constructor Summary
TextOverlayIcon(Icon aIcon, String aTextOverlay)
          Creates a new TextOverlayIcon instance, placing the text in the center of the icon.
TextOverlayIcon(Icon aIcon, String aTextOverlay, int aPosition)
          Creates a new TextOverlayIcon instance, placing the text at the given position.
 
Method Summary
 
Methods inherited from class javax.swing.ImageIcon
getAccessibleContext, getDescription, getIconHeight, getIconWidth, getImage, getImageLoadStatus, getImageObserver, loadImage, paintIcon, setDescription, setImage, setImageObserver, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextOverlayIcon

public TextOverlayIcon(Icon aIcon,
                       String aTextOverlay)
Creates a new TextOverlayIcon instance, placing the text in the center of the icon.

Parameters:
aIcon - the icon that should be overlayed;
aTextOverlay - the text that is to overlayed;

TextOverlayIcon

public TextOverlayIcon(Icon aIcon,
                       String aTextOverlay,
                       int aPosition)
Creates a new TextOverlayIcon instance, placing the text at the given position.

Parameters:
aIcon - the icon that should be overlayed;
aTextOverlay - the text that is to overlayed;
aPosition - on of the SwingConstants values that denotes the overlay position.


Copyright © 2012 L'Xtreme IT consultancy. All Rights Reserved.