Quaqua 8.0 2011-10-02

ch.randelshofer.quaqua.color
Class PaintableColor

java.lang.Object
  extended by java.awt.Color
      extended by ch.randelshofer.quaqua.color.PaintableColor
All Implemented Interfaces:
java.awt.Paint, java.awt.Transparency, java.io.Serializable
Direct Known Subclasses:
GradientColor, InactivatableColorUIResource, QuaquaRootPaneBackground, TextureColor

public abstract class PaintableColor
extends java.awt.Color

This is a Color with an optional 'hidden' Paint attribute. This is used to pass our Paint objects 'through' the Swing API, so that users of our Look and Feel can work with Paint objects like with regular colors, but Quaqua UI components will paint using the Paint instead of with the Color.

Version:
$Id: PaintableColor.java 361 2010-11-21 11:19:20Z wrandelshofer $
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Color
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
PaintableColor(int rgb)
           
PaintableColor(int argb, boolean hasAlpha)
          Creates a new instance.
PaintableColor(int r, int g, int b)
           
PaintableColor(int r, int g, int b, int a)
           
 
Method Summary
static java.awt.Paint getPaint(java.awt.Color color, java.awt.Component c)
          If the Color is an instance of PaintableColor, returns a Paint object which is properly configured for drawing on the component.
static java.awt.Paint getPaint(java.awt.Color color, java.awt.Component c, int xOffset, int yOffset)
          xOffset and yOffset are used to achieve the shifted texture effect that is used to render tabbed panes with Jaguar design.
static java.awt.Paint getPaint(java.awt.Color color, java.awt.Component c, int x, int y, int width, int height)
           
 java.awt.Paint getPaint(java.awt.Component c, int xOffset, int yOffset)
           
abstract  java.awt.Paint getPaint(java.awt.Component c, int x, int y, int width, int height)
           
protected static java.awt.Point getRootPaneOffset(java.awt.Component c)
          Returns the relative position (offset) of the component towards its root pane.
 
Methods inherited from class java.awt.Color
brighter, createContext, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGB, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, HSBtoRGB, RGBtoHSB, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PaintableColor

public PaintableColor(int argb,
                      boolean hasAlpha)
Creates a new instance.


PaintableColor

public PaintableColor(int rgb)

PaintableColor

public PaintableColor(int r,
                      int g,
                      int b)

PaintableColor

public PaintableColor(int r,
                      int g,
                      int b,
                      int a)
Method Detail

getPaint

public final java.awt.Paint getPaint(java.awt.Component c,
                                     int xOffset,
                                     int yOffset)

getPaint

public abstract java.awt.Paint getPaint(java.awt.Component c,
                                        int x,
                                        int y,
                                        int width,
                                        int height)

getPaint

public static java.awt.Paint getPaint(java.awt.Color color,
                                      java.awt.Component c)
If the Color is an instance of PaintableColor, returns a Paint object which is properly configured for drawing on the component. If the Color is not an instance of PaintableColor, returns the color.


getPaint

public static java.awt.Paint getPaint(java.awt.Color color,
                                      java.awt.Component c,
                                      int xOffset,
                                      int yOffset)
xOffset and yOffset are used to achieve the shifted texture effect that is used to render tabbed panes with Jaguar design.

Parameters:
xOffset - shifts the paint on the x-axis.
yOffset - shifts the paint on the y-axis.

getPaint

public static java.awt.Paint getPaint(java.awt.Color color,
                                      java.awt.Component c,
                                      int x,
                                      int y,
                                      int width,
                                      int height)

getRootPaneOffset

protected static java.awt.Point getRootPaneOffset(java.awt.Component c)
Returns the relative position (offset) of the component towards its root pane.


Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.