Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.ide.controls
Class ColorIcon

java.lang.Object
  extended by oracle.ide.controls.ColorIcon
All Implemented Interfaces:
javax.swing.Icon

public final class ColorIcon
extends java.lang.Object
implements javax.swing.Icon

The ColorIcon is an Icon implementation that is a simple rectangular shape with a black edge rim, and configurable center fill color. The size of the icon must be specified when it is created, but the fill color may be changed later.


Field Summary
static int DEFAULT_HEIGHT
          The default icon height (12) to use if none is specified.
static int DEFAULT_SIZE
          The default icon size (square) to use if none is specified.
static int DEFAULT_WIDTH
          The default icon width (12) to use if none is specified.
 
Constructor Summary
ColorIcon(java.awt.Color color)
          Construct a new ColorIcon with the given fill color and with a default size
ColorIcon(java.awt.Color color, java.awt.Dimension dimensions)
          Construct a new ColorIcon with the given fill color and dimensions.
ColorIcon(java.awt.Color color, int width, int height)
          Construct a new ColorIcon with the given fill color and dimensions.
 
Method Summary
 java.awt.Color getColor()
          Fetches the color that is currently used to fill the icon.
 int getIconHeight()
          Returns the icon's height.
 int getIconWidth()
          Returns the icon's width.
 void paintIcon(java.awt.Component component, java.awt.Graphics graphics, int x, int y)
          Draw the icon at the specified location.
 void setColor(java.awt.Color color)
          Changes the color that is used to fill the icon.
 void setSize(int width, int height)
          Changes the size of the icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final int DEFAULT_SIZE
The default icon size (square) to use if none is specified.

See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
The default icon width (12) to use if none is specified.

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
The default icon height (12) to use if none is specified.

See Also:
Constant Field Values
Constructor Detail

ColorIcon

public ColorIcon(java.awt.Color color)
Construct a new ColorIcon with the given fill color and with a default size

Parameters:
color - the fill color to use

ColorIcon

public ColorIcon(java.awt.Color color,
                 int width,
                 int height)
Construct a new ColorIcon with the given fill color and dimensions.

Parameters:
color - the fill color to use
width - the width to use
height - the height to use

ColorIcon

public ColorIcon(java.awt.Color color,
                 java.awt.Dimension dimensions)
Construct a new ColorIcon with the given fill color and dimensions.

Parameters:
color - the fill color to use
dimension - the width and height dimension to use
Method Detail

getColor

public java.awt.Color getColor()
Fetches the color that is currently used to fill the icon.

Returns:
the current icon color

setColor

public void setColor(java.awt.Color color)
Changes the color that is used to fill the icon. It is the caller's responsibility to issue a repaint on any components using this icon after changing its color.

Parameters:
color - the new color to use

setSize

public void setSize(int width,
                    int height)
Changes the size of the icon. It is the caller's responsibility to issue a repaint on any components using this icon after changing its size.

Parameters:
width - the width to use
height - the height to use

paintIcon

public void paintIcon(java.awt.Component component,
                      java.awt.Graphics graphics,
                      int x,
                      int y)
Draw 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()
Returns the icon's width.

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

getIconHeight

public int getIconHeight()
Returns the icon's height.

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

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.