CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.gui
Class VectorIcon

java.lang.Object
  extended by ch.randelshofer.gui.VectorIcon
All Implemented Interfaces:
javax.swing.Icon

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

An Icon which is composed of a set of java.awt.Shape's.

Version:
1.1 2003-03-16 Set rendering hints for antialiased rendering.
1.0 2001-09-02 Created.
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland

Constructor Summary
VectorIcon(java.awt.Shape p)
          Creates a new icon which is filled and drawn with the foreground color of the component.
VectorIcon(java.awt.Shape[] p, int width, int height, java.awt.Color fillColor, java.awt.Color outlineColor)
          Creates a new icon.
VectorIcon(java.awt.Shape p, java.awt.Color fillColor, java.awt.Color outlineColor)
          Creates a new icon.
VectorIcon(java.awt.Shape p, int width, int height)
          Creates a new icon which is filled and drawn with the foreground color of the component.
VectorIcon(java.awt.Shape p, int width, int height, java.awt.Color fillColor, java.awt.Color outlineColor)
          Creates a new icon.
 
Method Summary
 int getIconHeight()
          Gets the height of the icon.
 int getIconWidth()
          Gets the width of the icon.
 void paintIcon(java.awt.Component c, java.awt.Graphics gr, int x, int y)
          Draws the icon at the specified location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorIcon

public VectorIcon(java.awt.Shape[] p,
                  int width,
                  int height,
                  java.awt.Color fillColor,
                  java.awt.Color outlineColor)
Creates a new icon.

Parameters:
p - An Array of Shapes.
width - The fixed width of the icon.
height - The fixed height of the icon.
fillColor - The fill color of the icon, or null if not filled.
outlineColor - The outline color of the icon, or null if not outlined.

VectorIcon

public VectorIcon(java.awt.Shape p,
                  int width,
                  int height,
                  java.awt.Color fillColor,
                  java.awt.Color outlineColor)
Creates a new icon.

Parameters:
p - The Shape.
width - The fixed width of the icon.
height - The fixed height of the icon.
fillColor - The fill color of the icon, or null if not filled.
outlineColor - The outline color of the icon, or null if not outlined.

VectorIcon

public VectorIcon(java.awt.Shape p,
                  int width,
                  int height)
Creates a new icon which is filled and drawn with the foreground color of the component.

Parameters:
p - The Shape.
width - The fixed width of the icon.
height - The fixed height of the icon.

VectorIcon

public VectorIcon(java.awt.Shape p)
Creates a new icon which is filled and drawn with the foreground color of the component. The size of the VectorIcon is the bounding box of the shape.

Parameters:
p - The Shape.

VectorIcon

public VectorIcon(java.awt.Shape p,
                  java.awt.Color fillColor,
                  java.awt.Color outlineColor)
Creates a new icon. The size of the VectorIcon is the bounding box of the shape.

Parameters:
p - The Shape.
fillColor - The fill color of the icon, or null if not filled.
outlineColor - The outline color of the icon, or null if not outlined.
Method Detail

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics gr,
                      int x,
                      int y)
Draws the icon at the specified location. Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.

Specified by:
paintIcon in interface javax.swing.Icon

getIconWidth

public int getIconWidth()
Gets the width of the icon.

Specified by:
getIconWidth in interface javax.swing.Icon
Returns:
The fixed width of the icon.

getIconHeight

public int getIconHeight()
Gets the height of the icon.

Specified by:
getIconHeight in interface javax.swing.Icon
Returns:
The fixed height of the icon.

(c) Werner Randelshofer.
All rights reserved.