Home » openjdk-7 » javax.swing.plaf.nimbus » [javadoc | source]
javax.swing.plaf.nimbus
abstract public class: AbstractRegionPainter [javadoc | source]
java.lang.Object
   javax.swing.plaf.nimbus.AbstractRegionPainter

All Implemented Interfaces:
    Painter

Direct Known Subclasses:
    LoweredBorder, ToolBarSeparatorPainter

Convenient base class for defining Painter instances for rendering a region or component in Nimbus.
Nested Class Summary:
protected static class  AbstractRegionPainter.PaintContext  A class encapsulating state useful when painting. Generally, instances of this class are created once, and reused for each paint request without modification. This class contains values useful when hinting the cache engine, and when decoding control points and bezier curve anchors. 
Constructor:
 protected AbstractRegionPainter() 
Method from javax.swing.plaf.nimbus.AbstractRegionPainter Summary:
configureGraphics,   decodeAnchorX,   decodeAnchorY,   decodeColor,   decodeColor,   decodeGradient,   decodeRadialGradient,   decodeX,   decodeY,   doPaint,   getComponentColor,   getExtendedCacheKeys,   getPaintContext,   paint
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.plaf.nimbus.AbstractRegionPainter Detail:
 protected  void configureGraphics(Graphics2D g) 

    Configures the given Graphics2D. Often, rendering hints or compositiing rules are applied to a Graphics2D object prior to painting, which should affect all of the subsequent painting operations. This method provides a convenient hook for configuring the Graphics object prior to rendering, regardless of whether the render operation is performed to an intermediate buffer or directly to the display.

 protected final float decodeAnchorX(float x,
    float dx) 
    Decodes and returns a float value representing the actual pixel location for the anchor point given the encoded X value of the control point, and the offset distance to the anchor from that control point.
 protected final float decodeAnchorY(float y,
    float dy) 
    Decodes and returns a float value representing the actual pixel location for the anchor point given the encoded Y value of the control point, and the offset distance to the anchor from that control point.
 protected final Color decodeColor(Color color1,
    Color color2,
    float midPoint) 
    Decodes and returns a color, which is derived from a offset between two other colors.
 protected final Color decodeColor(String key,
    float hOffset,
    float sOffset,
    float bOffset,
    int aOffset) 
    Decodes and returns a color, which is derived from a base color in UI defaults.
 protected final LinearGradientPaint decodeGradient(float x1,
    float y1,
    float x2,
    float y2,
    float[] midpoints,
    Color[] colors) 
    Given parameters for creating a LinearGradientPaint, this method will create and return a linear gradient paint. One primary purpose for this method is to avoid creating a LinearGradientPaint where the start and end points are equal. In such a case, the end y point is slightly increased to avoid the overlap.
 protected final RadialGradientPaint decodeRadialGradient(float x,
    float y,
    float r,
    float[] midpoints,
    Color[] colors) 
    Given parameters for creating a RadialGradientPaint, this method will create and return a radial gradient paint. One primary purpose for this method is to avoid creating a RadialGradientPaint where the radius is non-positive. In such a case, the radius is just slightly increased to avoid 0.
 protected final float decodeX(float x) 
    Decodes and returns a float value representing the actual pixel location for the given encoded X value.
 protected final float decodeY(float y) 
    Decodes and returns a float value representing the actual pixel location for the given encoded y value.
 abstract protected  void doPaint(Graphics2D g,
    JComponent c,
    int width,
    int height,
    Object[] extendedCacheKeys)
    Actually performs the painting operation. Subclasses must implement this method. The graphics object passed may represent the actual surface being rendererd to, or it may be an intermediate buffer. It has also been pre-translated. Simply render the component as if it were located at 0, 0 and had a width of width and a height of height. For performance reasons, you may want to read the clip from the Graphics2D object and only render within that space.
 protected final Color getComponentColor(JComponent c,
    String property,
    Color defaultColor,
    float saturationOffset,
    float brightnessOffset,
    int alphaOffset) 
    Get a color property from the given JComponent. First checks for a getXXX() method and if that fails checks for a client property with key property. If that still fails to return a Color then defaultColor is returned.
 protected Object[] getExtendedCacheKeys(JComponent c) 
    Get any extra attributes which the painter implementation would like to include in the image cache lookups. This is checked for every call of the paint(g, c, w, h) method.
 abstract protected PaintContext getPaintContext()

    Gets the PaintContext for this painting operation. This method is called on every paint, and so should be fast and produce no garbage. The PaintContext contains information such as cache hints. It also contains data necessary for decoding points at runtime, such as the stretching insets, the canvas size at which the encoded points were defined, and whether the stretching insets are inverted.

    This method allows for subclasses to package the painting of different states with possibly different canvas sizes, etc, into one AbstractRegionPainter implementation.

 public final  void paint(Graphics2D g,
    JComponent c,
    int w,
    int h)