|
swingx Version 2005-08-19 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.JavaBean
org.jdesktop.swingx.painter.AbstractPainter
org.jdesktop.swingx.painter.ShapePainter
public class ShapePainter
A Painter that paints Shapes. It uses a stroke and a fillPaint to do so. The shape is painted as is, at a specific location. If no Shape is specified, nothing will be painted. If no stroke is specified, the default for the Graphics2D will be used. If no fillPaint is specified, the component background color will be used. And if no location is specified, then the shape will be draw at the origin (0,0)
Here is an example that draws a lowly rectangle:
Rectangle2D.Double rect = new Rectangle2D.Double(0, 0, 50, 50);
ShapePainter p = new ShapePainter(rect);
p.setLocation(new Point2D.Double(20, 10));
Nested Class Summary | |
---|---|
static class |
ShapePainter.Style
Different available fill styles. |
Constructor Summary | |
---|---|
ShapePainter()
Create a new ShapePainter |
|
ShapePainter(Shape shape)
Create a new ShapePainter with the specified shape. |
|
ShapePainter(Shape shape,
Paint paint)
Create a new ShapePainter with the specified shape and fillPaint. |
|
ShapePainter(Shape shape,
Paint paint,
ShapePainter.Style style)
Create a new ShapePainter with the specified shape and fillPaint. |
Method Summary | |
---|---|
Paint |
getFillPaint()
|
Point2D |
getLocation()
|
Resize |
getResize()
|
Resize |
getResizeLocation()
|
Shape |
getShape()
|
Stroke |
getStroke()
|
Paint |
getStrokePaint()
|
ShapePainter.Style |
getStyle()
|
void |
paintBackground(Graphics2D g,
JComponent component)
Subclasses should implement this method and perform custom painting operations here. |
void |
setFillPaint(Paint p)
The Paint to use for filling the shape. |
void |
setLocation(Point2D location)
Specifies the location at which to place the shape prior to painting. |
void |
setResize(Resize r)
Specifies the resize behavior of the shape. |
void |
setResizeLocation(Resize r)
Specifies the resize behavior for the location property. |
void |
setShape(Shape s)
Sets the shape to fillPaint. |
void |
setStroke(Stroke s)
Sets the stroke to use for painting. |
void |
setStrokePaint(Paint p)
The Paint to use for stroking the shape (painting the outline). |
void |
setStyle(ShapePainter.Style s)
The shape can be filled or simply stroked (outlined), or both. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShapePainter()
public ShapePainter(Shape shape)
shape
- the shape to fillPaintpublic ShapePainter(Shape shape, Paint paint)
shape
- the shape to fillPaintpaint
- the fillPaint to be used to fillPaint the shapepublic ShapePainter(Shape shape, Paint paint, ShapePainter.Style style)
shape
- the shape to fillPaintpaint
- the fillPaint to be used to fillPaint the shapestyle
- specifies the ShapePainter.Style to use for painting this shape.
If null, then Style.BOTH is usedMethod Detail |
---|
public void setShape(Shape s)
s
- the Shape to fillPaint. May be nullpublic Shape getShape()
public void setStroke(Stroke s)
s
- the Stroke to fillPaint withpublic Stroke getStroke()
public void setFillPaint(Paint p)
p
- the Paint to use for painting the shape. May be null.public Paint getFillPaint()
public void setStrokePaint(Paint p)
p
- the Paint to use for stroking the shape. May be null.public Paint getStrokePaint()
public void setLocation(Point2D location)
location
- the Point2D at which to fillPaint the shape. may be nullpublic Point2D getLocation()
public void setStyle(ShapePainter.Style s)
s
- the Style to use. If null, Style.BOTH is usedpublic ShapePainter.Style getStyle()
public void setResizeLocation(Resize r)
r
- value indicating whether/how to resize the Location property when
painting. If null, Resize.BOTH will be usedpublic Resize getResizeLocation()
public void setResize(Resize r)
r
- value indication whether/how to resize the shape. If null,
Resize.NONE will be usedpublic Resize getResize()
public void paintBackground(Graphics2D g, JComponent component)
AbstractPainter
paintBackground
in class AbstractPainter
g
- The Graphics2D object in which to paintcomponent
- The JComponent that the Painter is delegate for.
|
swingx Version 2005-08-19 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |