|
swingx Version 2009-07-31 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.beans.AbstractBean
org.jdesktop.swingx.painter.AbstractPainter<T>
org.jdesktop.swingx.painter.AbstractLayoutPainter<T>
org.jdesktop.swingx.painter.AbstractAreaPainter<Object>
org.jdesktop.swingx.painter.MattePainter
public class MattePainter
A Painter implementation that uses a Paint to fill the entire background area. For example, if I wanted to paint the entire background of a panel green, I would:
MattePainter p = new MattePainter(Color.GREEN);
panel.setBackgroundPainter(p);
Since it accepts a Paint, it is also possible to paint a texture or use other more exotic Paint implementations. To paint a BufferedImage texture as the background:
TexturePaint paint = new TexturePaint(bufferedImage,
new Rectangle2D.Double(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight()));
MattePainter p = new MattePainter(paint);
panel.setBackgroundPainter(p);
If no paint is specified, then nothing is painted
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractAreaPainter |
---|
AbstractAreaPainter.Style |
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 | |
---|---|
MattePainter()
Creates a new MattePainter with "null" as the paint used |
|
MattePainter(Paint paint)
Create a new MattePainter for the given Paint. |
|
MattePainter(Paint paint,
boolean paintStretched)
Create a new MattePainter for the given Paint. |
Method Summary | |
---|---|
protected void |
doPaint(Graphics2D g,
Object component,
int width,
int height)
Subclasses must implement this method and perform custom painting operations here. |
Shape |
provideShape(Graphics2D g,
Object comp,
int width,
int height)
Returns the outline shape of this painter. |
Methods inherited from class org.jdesktop.swingx.painter.AbstractAreaPainter |
---|
getAreaEffects, getBorderPaint, getBorderWidth, getFillPaint, getStyle, isPaintStretched, setAreaEffects, setBorderPaint, setBorderWidth, setFillPaint, setPaintStretched, setStyle |
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, getFilters, getInterpolation, isAntialiasing, isCacheable, isDirty, isVisible, paint, setAntialiasing, setCacheable, setDirty, setFilters, setInterpolation, setVisible, shouldUseCache, validate |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MattePainter()
public MattePainter(Paint paint)
paint
- Paint to fill withpublic MattePainter(Paint paint, boolean paintStretched)
paint
- Paint to fill withpaintStretched
- indicates if the paint should be stretchedMethod Detail |
---|
protected void doPaint(Graphics2D g, Object component, int width, int height)
doPaint
in class AbstractPainter<Object>
g
- The Graphics2D object in which to paintpublic Shape provideShape(Graphics2D g, Object comp, int width, int height)
AbstractAreaPainter
provideShape
in class AbstractAreaPainter<Object>
g
- graphicscomp
- The Object this painter will be painted on.width
- the width to paintheight
- the height to paint
|
swingx Version 2009-07-31 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |