|
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.MattePainter
public class MattePainter
A Painter implementation that uses a Paint to fill the entire background area using that Paint. For example, if I wanted to paint the entire background in Color.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
| Constructor Summary | |
|---|---|
MattePainter()
Creates a new MattePainter with "null" as the paint used |
|
MattePainter(Color color)
Create a new MattePainter that uses the given color. |
|
MattePainter(Paint paint)
Create a new MattePainter for the given Paint. |
|
| Method Summary | |
|---|---|
Paint |
getPaint()
|
void |
paintBackground(Graphics2D g,
JComponent component)
Subclasses should implement this method and perform custom painting operations here. |
void |
setPaint(Paint p)
Sets the Paint to use. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MattePainter()
public MattePainter(Color color)
color - Color to fill withpublic MattePainter(Paint paint)
paint - Paint to fill with| Method Detail |
|---|
public void setPaint(Paint p)
p - the Paint to usepublic Paint getPaint()
public void paintBackground(Graphics2D g,
JComponent component)
AbstractPainter
paintBackground in class AbstractPainterg - 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 | |||||||||