public class GlossPainter extends AbstractPainter<Object>
A Painter implementation that simulates a gloss effect. The gloss can be positioned at the top or bottom of the drawing area. To fill the gloss, this painter uses a Paint instance which can be used to fill with a color (opaque or translucent), a texture, a gradient...
The following example creates a white gloss at the top of the drawing area:
GlossPainter p = new GlossPainter(); p.setPaint(new Color(1.0f, 1.0f, 1.0f, 0.2f); p.setPosition(GlossPainter.GlossPosition.TOP); panel.setBackgroundPainter(p);
The values shown in this examples are the values used by default if they are not specified.
Modifier and Type | Class and Description |
---|---|
static class |
GlossPainter.GlossPosition
Used to define the position of the gloss on the painted area.
|
AbstractPainter.Interpolation
Modifier and Type | Field and Description |
---|---|
private Paint |
paint |
private GlossPainter.GlossPosition |
position |
Constructor and Description |
---|
GlossPainter()
Creates a new gloss painter positioned at the top of the painted
area with a 20% translucent white color.
|
GlossPainter(GlossPainter.GlossPosition position)
Creates a new gloss painter positioned at the specified position
and using a white, 20% translucent paint.
|
GlossPainter(Paint paint)
Creates a new gloss painter positioned at the top of the painted
area with the specified paint.
|
GlossPainter(Paint paint,
GlossPainter.GlossPosition position)
Creates a new gloss painter positioned at the specified position
and painted with the specified paint.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doPaint(Graphics2D g,
Object component,
int width,
int height)
Subclasses must implement this method and perform custom painting operations
here.
|
Paint |
getPaint()
Returns the paint currently used by the painter to fill the gloss.
|
GlossPainter.GlossPosition |
getPosition()
Returns the position at which the gloss is painted.
|
void |
setPaint(Paint paint)
Changes the paint to be used to fill the gloss.
|
void |
setPosition(GlossPainter.GlossPosition position)
Changes the position of the gloss in the painted area.
|
clearCache, configureGraphics, getFilters, getInterpolation, isAntialiasing, isCacheable, isCacheCleared, isDirty, isInPaintContext, isVisible, paint, setAntialiasing, setCacheable, setDirty, setFilters, setInPaintContext, setInterpolation, setVisible, shouldUseCache, validate
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
private GlossPainter.GlossPosition position
public GlossPainter()
Creates a new gloss painter positioned at the top of the painted area with a 20% translucent white color.
public GlossPainter(Paint paint)
Creates a new gloss painter positioned at the top of the painted area with the specified paint.
paint
- The paint to be used when filling the glosspublic GlossPainter(GlossPainter.GlossPosition position)
Creates a new gloss painter positioned at the specified position and using a white, 20% translucent paint.
position
- The position of the gloss on the painted areapublic GlossPainter(Paint paint, GlossPainter.GlossPosition position)
Creates a new gloss painter positioned at the specified position and painted with the specified paint.
paint
- The paint to be used when filling the glossposition
- The position of the gloss on the painted areaprotected void doPaint(Graphics2D g, Object component, int width, int height)
doPaint
in class AbstractPainter<Object>
g
- The Graphics2D object in which to paintpublic Paint getPaint()
Returns the paint currently used by the painter to fill the gloss.
public void setPaint(Paint paint)
Changes the paint to be used to fill the gloss. When the specified paint is null, nothing is painted. A paint can be an instance of Color.
paint
- The Paint instance to be used to fill the glosspublic GlossPainter.GlossPosition getPosition()
Returns the position at which the gloss is painted.
public void setPosition(GlossPainter.GlossPosition position)
Changes the position of the gloss in the painted area. Only the values defined in the GlossPosition enum are valid.
position
- The position at which the gloss is paintedWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses