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 PinstripePainter

    java.lang.Object
      org.jdesktop.beans.AbstractBean
          org.jdesktop.swingx.painter.AbstractPainter<java.lang.Object>
              org.jdesktop.swingx.painter.PinstripePainter

All Implemented Interfaces:
  Painter<java.lang.Object>

    public class PinstripePainter

extends AbstractPainter<java.lang.Object>

A fun Painter that paints pinstripes. You can specify the Paint to paint those pinstripes in (could even be a texture paint!), the angle at which to paint the pinstripes, and the spacing between stripes.

The default PinstripePainter configuration will paint the pinstripes using the foreground color of the component (the default behavior if a Paint is not specified) at a 45 degree angle with 8 pixels between stripes

Here is a custom code snippet that paints Color.GRAY pinstripes at a 135 degree angle:

      PinstripePainter p = new PinstripePainter();
      p.setAngle(135);
      p.setPaint(Color.GRAY);

Author:
  rbair

Nested Class Summary

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

Constructor Summary
`PinstripePainter()` Create a new PinstripePainter.
`PinstripePainter(double angle)` Create a new PinstripePainter using the given angle, 8 pixel spacing, and the foreground color of the Component
`PinstripePainter(java.awt.Paint paint)` Create a new PinstripePainter using an angle of 45, 8 pixel spacing, and the given Paint.
`PinstripePainter(java.awt.Paint paint, double angle)` Create a new PinstripePainter using the given angle, 8 pixel spacing, and the given Paint
`PinstripePainter(java.awt.Paint paint, double angle, double stripeWidth, double spacing)` Create a new PinstripePainter with the specified paint, angle, stripe width, and stripe spacing.

Method Summary
`protected void` | `doPaint(java.awt.Graphics2D g, java.lang.Object component, int width, int height)` Subclasses must implement this method and perform custom painting operations here.
`double` | `getAngle()` Gets the current angle of the pinstripes
`java.awt.Paint` | `getPaint()` Get the current paint used for drawing the pinstripes
`double` | `getSpacing()` Get the current spacing between the stripes
`double` | `getStripeWidth()` Gets the current width of the pinstripes
`void` | `setAngle(double angle)` Sets the angle, in degrees, at which to paint the pinstripes.
`void` | `setPaint(java.awt.Paint p)` Set the paint to use for drawing the pinstripes
`void` | `setSpacing(double spacing)` Sets the spacing between pinstripes
`void` | `setStripeWidth(double stripeWidth)` Set the width of the pinstripes

Methods inherited from class org.jdesktop.swingx.painter.AbstractPainter
`clearCache, configureGraphics, 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

### PinstripePainter

    public PinstripePainter()

  Create a new PinstripePainter. By default the angle with be 45 degrees, the spacing will be 8 pixels, and the color will be the Component foreground color.

### PinstripePainter

    public PinstripePainter(java.awt.Paint paint)

  Create a new PinstripePainter using an angle of 45, 8 pixel spacing, and the given Paint.

  Parameters:
    `paint` - the paint used when drawing the stripes

### PinstripePainter

    public PinstripePainter(java.awt.Paint paint,
                            double angle)

  Create a new PinstripePainter using the given angle, 8 pixel spacing, and the given Paint

  Parameters:
    `paint` - the paint used when drawing the stripes
    `angle` - the angle, in degrees, in which to paint the pinstripes

### PinstripePainter

    public PinstripePainter(double angle)

  Create a new PinstripePainter using the given angle, 8 pixel spacing, and the foreground color of the Component

  Parameters:
    `angle` - the angle, in degrees, in which to paint the pinstripes

### PinstripePainter

    public PinstripePainter(java.awt.Paint paint,
                            double angle,
                            double stripeWidth,
                            double spacing)

  Create a new PinstripePainter with the specified paint, angle, stripe width, and stripe spacing.

  Parameters:
    `paint` -
    `angle` -
    `stripeWidth` -
    `spacing` -

Method Detail

### setPaint

    public void setPaint(java.awt.Paint p)

  Set the paint to use for drawing the pinstripes

  Parameters:
    `p` - the Paint to use. May be a Color.

### getPaint

    public java.awt.Paint getPaint()

  Get the current paint used for drawing the pinstripes

  Returns:
    the Paint to use to draw the pinstripes

### setAngle

    public void setAngle(double angle)

  Sets the angle, in degrees, at which to paint the pinstripes. If the given angle is < 0 or > 360, it will be appropriately constrained. For example, if a value of 365 is given, it will result in 5 degrees. The conversion is not perfect, but "a man on a galloping horse won't be able to tell the difference".

  Parameters:
    `angle` - the Angle in degrees at which to paint the pinstripes

### getAngle

    public double getAngle()

  Gets the current angle of the pinstripes

  Returns:
    the angle, in degrees, at which the pinstripes are painted

### setSpacing

    public void setSpacing(double spacing)

  Sets the spacing between pinstripes

  Parameters:
    `spacing` - spacing between pinstripes

### getSpacing

    public double getSpacing()

  Get the current spacing between the stripes

  Returns:
    the spacing between pinstripes

### doPaint

    protected void doPaint(java.awt.Graphics2D g,
                           java.lang.Object component,
                           int width,
                           int height)

  Subclasses must implement this method and perform custom painting operations here.

  Specified by:
    `doPaint` in class `AbstractPainter<java.lang.Object>`
  Parameters:
    `g` - The Graphics2D object in which to paint

### getStripeWidth

    public double getStripeWidth()

  Gets the current width of the pinstripes

  Returns:
    the current pinstripe width

### setStripeWidth

    public void setStripeWidth(double stripeWidth)

  Set the width of the pinstripes

  Parameters:
    `stripeWidth` - a new width for the pinstripes

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.