Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx.painter
Class AbstractAreaPainter<T>

    java.lang.Object
      org.jdesktop.beans.AbstractBean
          org.jdesktop.swingx.painter.AbstractPainter<T>
              org.jdesktop.swingx.painter.AbstractLayoutPainter<T>
                  org.jdesktop.swingx.painter.AbstractAreaPainter<T>

All Implemented Interfaces:
  Painter<T>

Direct Known Subclasses:
  CapsulePainter, ImagePainter, MattePainter, RectanglePainter, ShapePainter, TextPainter

    public abstract class AbstractAreaPainter<T>

extends AbstractLayoutPainter<T>

The abstract base class for all painters that fill a vector path area. This includes Shapes, Rectangles, Text, and the MattePainter which fills in the entire background of a component. The defining feature of AbstractAreaPainter subclasses is that they implement the provideShape() method which returns the outline shape of the area that this painter will fill. Subclasses must implement the provideShape() method. The AbstractAreaPainter provides support for the following common painting properties

- fillPaint
- paintStretched
- borderPaint
- borderWidth
- style

The AbstractAreaPainter also provides support for path effects like dropshadows and glows.

Author:
  joshua@marinacci.org

Nested Class Summary
`static class` | `AbstractAreaPainter.Style` Different available fill styles.

Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractLayoutPainter
`AbstractLayoutPainter.HorizontalAlignment, AbstractLayoutPainter.VerticalAlignment`

Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractPainter
`AbstractPainter.Interpolation`

Constructor Summary
`AbstractAreaPainter()` Creates a new instance of AbstractAreaPainter
`AbstractAreaPainter(java.awt.Paint paint)` Creates a new instance of AbstractAreaPainter

Method Summary
`AreaEffect[]` | `getAreaEffects()` Gets the current set of path effects applied to this painter.
`java.awt.Paint` | `getBorderPaint()` Gets the current Paint to use for stroking the shape (painting the outline).
`float` | `getBorderWidth()` Gets the current border width.
`java.awt.Paint` | `getFillPaint()` Gets the current fill paint.
`AbstractAreaPainter.Style` | `getStyle()` Gets the current Style.
`boolean` | `isPaintStretched()` Indicates if the paint will be snapped.
`protected abstract java.awt.Shape` | `provideShape(java.awt.Graphics2D g, T comp, int width, int height)` Returns the outline shape of this painter.
`void` | `setAreaEffects(AreaEffect... areaEffects)` Sets the path effects to be drawn on this painter.
`void` | `setBorderPaint(java.awt.Paint p)` The Paint to use for stroking the shape (painting the outline).
`void` | `setBorderWidth(float s)` Sets the border width to use for painting.
`void` | `setFillPaint(java.awt.Paint p)` Sets the Paint to use.
`void` | `setPaintStretched(boolean paintStretched)` Specifies whether this Painter should attempt to resize the Paint to fit the area being painted.
`void` | `setStyle(AbstractAreaPainter.Style s)` The shape can be filled or simply stroked (outlined), or both or none.

Methods inherited from class org.jdesktop.swingx.painter.AbstractLayoutPainter
`calculateLayout, getHorizontalAlignment, getInsets, getVerticalAlignment, isFillHorizontal, isFillVertical, setFillHorizontal, setFillVertical, setHorizontalAlignment, setInsets, setVerticalAlignment`

Methods inherited from class org.jdesktop.swingx.painter.AbstractPainter
`clearCache, configureGraphics, doPaint, getFilters, getInterpolation, isAntialiasing, isCacheable, isDirty, isVisible, paint, setAntialiasing, setCacheable, setDirty, setFilters, setInterpolation, setVisible, shouldUseCache, validate`

Methods inherited from class org.jdesktop.beans.AbstractBean
`addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractAreaPainter

    public AbstractAreaPainter()

  Creates a new instance of AbstractAreaPainter

### AbstractAreaPainter

    public AbstractAreaPainter(java.awt.Paint paint)

  Creates a new instance of AbstractAreaPainter

  Parameters:
    `paint` - the default paint to fill this area painter with

Method Detail

### getFillPaint

    public java.awt.Paint getFillPaint()

  Gets the current fill paint. This is the Paint object that will be used to fill the path area.

  Returns:
    Gets the Paint being used. May be null

### setFillPaint

    public void setFillPaint(java.awt.Paint p)

  Sets the Paint to use. This is the Paint object that will be used to fill the path area. If null, nothing is painted

  Parameters:
    `p` - the Paint to use

### isPaintStretched

    public boolean isPaintStretched()

  Indicates if the paint will be snapped. This means that the paint will be scaled and aligned along the 4 axis of (horizontal, vertical, and both diagonals). Snapping allows the paint to be stretched across the component when it is drawn, even if the component is resized. This setting is only used for gradient paints. It will have no effect on Color or Texture paints.

  Returns:
    the current value of the snapPaint property

### setPaintStretched

    public void setPaintStretched(boolean paintStretched)

  Specifies whether this Painter should attempt to resize the Paint to fit the area being painted. For example, if true, then a gradient specified as (0, 0), (1, 0) would stretch horizontally such that the beginning of the gradient is on the left edge of the painted region, and the end of the gradient is at the right edge of the painted region. Specifically, if true, the resizePaint method will be called to perform the actual resizing of the Paint

  Parameters:
    `paintStretched` - true if the paint should be stretched, false otherwise.

### setBorderPaint

    public void setBorderPaint(java.awt.Paint p)

  The Paint to use for stroking the shape (painting the outline). Can be a Color, GradientPaint, TexturePaint, or any other kind of Paint. If null, the component foreground is used.

  Parameters:
    `p` - the Paint to use for stroking the shape. May be null.

### getBorderPaint

    public java.awt.Paint getBorderPaint()

  Gets the current Paint to use for stroking the shape (painting the outline). Can be a Color, GradientPaint, TexturePaint, or any other kind of Paint. If null, the component foreground is used.

  Returns:
    the Paint used when stroking the shape. May be null

### setStyle

    public void setStyle(AbstractAreaPainter.Style s)

  The shape can be filled or simply stroked (outlined), or both or none. By default, the shape is both filled and stroked. This property specifies the strategy to use.

  Parameters:
    `s` - the Style to use. If null, Style.BOTH is used

### getStyle

    public AbstractAreaPainter.Style getStyle()

  Gets the current Style. The shape can be filled or simply stroked (outlined), or both or none. By default, the shape is both filled and stroked. This property specifies the strategy to use.

  Returns:
    the Style used

### setBorderWidth

    public void setBorderWidth(float s)

  Sets the border width to use for painting. If null, then the default Graphics2D stroke will be used. The stroke will be centered on the actual shape outline.

  Parameters:
    `s` - the Stroke to fillPaint with

### getBorderWidth

    public float getBorderWidth()

  Gets the current border width.

  Returns:
    the Stroke to use for painting

### provideShape

    protected abstract java.awt.Shape provideShape(java.awt.Graphics2D g,
                                                   T comp,
                                                   int width,
                                                   int height)

  Returns the outline shape of this painter. Subclasses must implement this method. This shape will be used for filling, stroking, and clipping.

  Parameters:
    `g` - graphics
    `comp` - The Object this painter will be painted on.
    `width` - the width to paint
    `height` - the height to paint
  Returns:
    the outline shape of this painter

### setAreaEffects

    public void setAreaEffects(AreaEffect... areaEffects)

  Sets the path effects to be drawn on this painter. Set this to null in order to remove all installed effects.

  Parameters:
    `areaEffects` - the effects to apply to this painter

### getAreaEffects

    public AreaEffect[] getAreaEffects()

  Gets the current set of path effects applied to this painter. Returned array is guarantied to be not null.

  Returns:
    the effects applied to this path painter

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.