|
||||||||||
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.CompoundPainter<T>
public class CompoundPainter<T>
A Painter
implementation composed of an array of Painter
s.
CompoundPainter
provides a means for combining several individual
Painter
s, or groups of them, into one logical unit. Each of the
Painter
s are executed in order. BufferedImageOp filter effects can
be applied to them together as a whole. The entire set of painting operations
may be cached together.
For example, if I want to create a CompoundPainter that started with a blue background, had pinstripes on it running at a 45 degree angle, and those pinstripes appeared to "fade in" from left to right, I would write the following:
Color blue = new Color(0x417DDD);
Color translucent = new Color(blue.getRed(), blue.getGreen(), blue.getBlue(), 0);
panel.setBackground(blue);
panel.setForeground(Color.LIGHT_GRAY);
GradientPaint blueToTranslucent = new GradientPaint(
new Point2D.Double(.4, 0),
blue,
new Point2D.Double(1, 0),
translucent);
MattePainter veil = new MattePainter(blueToTranslucent);
veil.setPaintStretched(true);
Painter pinstripes = new PinstripePainter(45);
Painter backgroundPainter = new RectanglePainter(this.getBackground(), null);
Painter p = new CompoundPainter(backgroundPainter, pinstripes, veil);
panel.setBackgroundPainter(p);
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jdesktop.swingx.painter.AbstractPainter |
---|
AbstractPainter.Interpolation |
Constructor Summary | |
---|---|
CompoundPainter()
Creates a new instance of CompoundPainter |
|
CompoundPainter(Painter... painters)
Convenience constructor for creating a CompoundPainter for an array of painters. |
Method Summary | |
---|---|
void |
clearCache()
Clears the cache of this Painter , and all child
Painters . |
void |
clearLocalCache()
Clears the cache of this painter only, and not of any of the children. |
Painter[] |
getPainters()
Gets the array of painters used by this CompoundPainter |
java.awt.geom.AffineTransform |
getTransform()
Gets the current transform applied to all painters in this CompoundPainter. |
boolean |
isCheckingDirtyChildPainters()
Used by isDirty() to check if the child Painter s
should be checked for their dirty flag as part of
processing. |
boolean |
isClipPreserved()
Indicates if the clip produced by any painter is left set once it finishes painting. |
void |
setCheckingDirtyChildPainters(boolean b)
Set the flag used by isDirty() to check if the
child Painter s should be checked for their
dirty flag as part of processing. |
void |
setClipPreserved(boolean shouldRestoreState)
Sets if the clip should be preserved. |
void |
setPainters(Painter... painters)
Sets the array of Painters to use. |
void |
setTransform(java.awt.geom.AffineTransform transform)
Set a transform to be applied to all painters contained in this CompoundPainter |
Methods inherited from class org.jdesktop.swingx.painter.AbstractPainter |
---|
getFilters, getInterpolation, isAntialiasing, isCacheable, isVisible, paint, setAntialiasing, setCacheable, setFilters, setInterpolation, setVisible |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompoundPainter()
public CompoundPainter(Painter... painters)
painters
- array of painters, which will be painted in orderMethod Detail |
---|
public void setPainters(Painter... painters)
painters
- array of painters, which will be painted in orderpublic final Painter[] getPainters()
public boolean isClipPreserved()
setClipPreserved(boolean)
public void setClipPreserved(boolean shouldRestoreState)
shouldRestoreState
- new value of the clipPreserved propertyisClipPreserved()
public java.awt.geom.AffineTransform getTransform()
public void setTransform(java.awt.geom.AffineTransform transform)
transform
- a new AffineTransformpublic boolean isCheckingDirtyChildPainters()
isDirty()
to check if the child Painter
s
should be checked for their dirty
flag as part of
processing.true
Painter
s are different from each other. This
will allow the cacheable == true
Painter
s to
keep their cached image during regular repaints. In this case,
client code should call clearCache()
manually when the cacheable
Painter
s should be updated.
isDirty()
public void setCheckingDirtyChildPainters(boolean b)
isDirty()
to check if the
child Painter
s should be checked for their
dirty
flag as part of processing.
isCheckingDirtyChildPainters()
,
isDirty()
public void clearCache()
Clears the cache of this Painter
, and all child
Painters
. This is done to ensure that resources
are collected, even if clearCache is called by some framework
or other code that doesn't realize this is a CompoundPainter.
Call #clearLocalCache if you only want to clear the cache of this
CompoundPainter
Call this method to clear the cacheable. This may be called whether there is
a cacheable being used or not. If cleared, on the next call to paint
,
the painting routines will be called.
SubclassesIf overridden in subclasses, you must call super.clearCache, or physical resources (such as an Image) may leak.
clearCache
in class AbstractPainter<T>
public void clearLocalCache()
Clears the cache of this painter only, and not of any of the children.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |