edu.cmu.hcii.calo.view.IconRenderer Class Reference

Collaboration diagram for edu.cmu.hcii.calo.view.IconRenderer:

Collaboration graph
[legend]
List of all members.

Detailed Description

A utility class that can generate alternate states for icons (including mouseover, pressed, selected, and disabled states) based on the pixel data of the normal state, as well as badge them and draw text on them.

Note:
Although you can freely create instances of IconRenderer, in most cases it is more efficient to call the static getInstance() method to return the shared IconRenderer.
Author:
Brian Ellis


Public Types

enum  BadgePosition
 The possibilities for badge positioning. More...
enum  IconState
 The states in which an icon may be rendered by the IconRenderer. More...

Public Member Functions

ImageIcon badgeIcon (ImageIcon icon, ImageIcon badge, BadgePosition position)
 Badges the given base icon with the given badge icon, positioning the badge over the icon based on the position constant specified.
ImageIcon drawTextOnIcon (ImageIcon icon, String text, Font font, Color textColor)
 Draws the given text string in the center of the icon with the given font and color.
ImageIcon renderIcon (ImageIcon icon, IconState state)
 Renders the given ImageIcon transformed into the state specified, and returns the resulting icon.

Static Public Member Functions

static IconRenderer getInstance ()
 Returns the shared IconRenderer instance, creating it if necessary.

Static Private Attributes

static IconRenderer sharedInstance = null
 The shared IconRenderer instance.


Member Enumeration Documentation

enum edu::cmu::hcii::calo::view::IconRenderer::BadgePosition

The possibilities for badge positioning.

Author:
Brian Ellis

enum edu::cmu::hcii::calo::view::IconRenderer::IconState

The states in which an icon may be rendered by the IconRenderer.

Author:
Brian Ellis


Member Function Documentation

static IconRenderer edu.cmu.hcii.calo.view.IconRenderer.getInstance (  )  [static]

Returns the shared IconRenderer instance, creating it if necessary.

Returns:

ImageIcon edu.cmu.hcii.calo.view.IconRenderer.badgeIcon ( ImageIcon  icon,
ImageIcon  badge,
BadgePosition  position 
)

Badges the given base icon with the given badge icon, positioning the badge over the icon based on the position constant specified.

Note that the badge icon should really be smaller than the base icon, or it won't look very good. In particular, the resulting badged icon will always be the same size as the base icon.

Parameters:
icon the base icon
badge the badge icon to apply to the base icon
position the position of the badge on the icon
Returns:
a badged version of the base icon

ImageIcon edu.cmu.hcii.calo.view.IconRenderer.drawTextOnIcon ( ImageIcon  icon,
String  text,
Font  font,
Color  textColor 
)

Draws the given text string in the center of the icon with the given font and color.

The size of the font is ignored, however, and the String is drawn with a small enough size so as to completely fit within the bounds of the icon.

Parameters:
icon the icon to draw the text over
text the text to draw
font the font to draw the text in
textColor the color to draw the text with
Returns:
the resulting icon

ImageIcon edu.cmu.hcii.calo.view.IconRenderer.renderIcon ( ImageIcon  icon,
IconState  state 
)

Renders the given ImageIcon transformed into the state specified, and returns the resulting icon.

See the IconState enum for a description of the state constants.

Parameters:
icon the icon to render
state the state to render the icon in.
Returns:
the transformed icon


Member Data Documentation

IconRenderer edu.cmu.hcii.calo.view.IconRenderer.sharedInstance = null [static, private]

The shared IconRenderer instance.


The documentation for this class was generated from the following file:
Generated on Mon Aug 13 15:06:22 2007 for CALO by  doxygen 1.5.2