java.lang.Object | |
↳ | com.sun.java.swing.plaf.nimbus.AbstractRegionPainter |
Known Direct Subclasses |
Convenient base class for defining Painter instances for rendering a region or component in Nimbus.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AbstractRegionPainter.PaintContext | A class encapsulating state useful when painting. |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new AbstractRegionPainter
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Configures the given Graphics2D. | |||||||||||
Decodes and returns a float value representing the actual pixel location for
the anchor point given the encoded X value of the control point, and the offset
distance to the anchor from that control point.
| |||||||||||
Decodes and returns a float value representing the actual pixel location for
the anchor point given the encoded Y value of the control point, and the offset
distance to the anchor from that control point.
| |||||||||||
Decodes and returns a color, which is derived from a offset between two
other colors.
| |||||||||||
Decodes and returns a color, which is derived from a base color in UI
defaults.
| |||||||||||
Given parameters for creating a LinearGradientPaint, this method will
create and return a linear gradient paint.
| |||||||||||
Given parameters for creating a RadialGradientPaint, this method will
create and return a radial gradient paint.
| |||||||||||
Decodes and returns a float value representing the actual pixel location for
the given encoded X value.
| |||||||||||
Decodes and returns a float value representing the actual pixel location for
the given encoded y value.
| |||||||||||
Actually performs the painting operation.
| |||||||||||
Get a color property from the given JComponent.
| |||||||||||
Get any extra attributes which the painter implementation would like
to include in the image cache lookups.
| |||||||||||
Gets the PaintContext for this painting operation. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.sun.java.swing.Painter
|
Create a new AbstractRegionPainter
Configures the given Graphics2D. Often, rendering hints or compositiing rules are applied to a Graphics2D object prior to painting, which should affect all of the subsequent painting operations. This method provides a convenient hook for configuring the Graphics object prior to rendering, regardless of whether the render operation is performed to an intermediate buffer or directly to the display.
g | The Graphics2D object to configure. Will not be null. |
---|
Decodes and returns a float value representing the actual pixel location for the anchor point given the encoded X value of the control point, and the offset distance to the anchor from that control point.
x | an encoded x value of the bezier control point (0...1, or 1...2, or 2...3) |
---|---|
dx | the offset distance to the anchor from the control point x |
IllegalArgumentException | if x < 0 or x > 3
|
---|
Decodes and returns a float value representing the actual pixel location for the anchor point given the encoded Y value of the control point, and the offset distance to the anchor from that control point.
y | an encoded y value of the bezier control point (0...1, or 1...2, or 2...3) |
---|---|
dy | the offset distance to the anchor from the control point y |
IllegalArgumentException | if y < 0 or y > 3
|
---|
Decodes and returns a color, which is derived from a offset between two other colors.
color1 | The first color |
---|---|
color2 | The second color |
midPoint | The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2; |
Decodes and returns a color, which is derived from a base color in UI defaults.
key | A key corrosponding to the value in the UI Defaults table of UIManager where the base color is defined |
---|---|
hOffset | The hue offset used for derivation. |
sOffset | The saturation offset used for derivation. |
bOffset | The brightness offset used for derivation. |
aOffset | The alpha offset used for derivation. Between 0...255 |
Given parameters for creating a LinearGradientPaint, this method will create and return a linear gradient paint. One primary purpose for this method is to avoid creating a LinearGradientPaint where the start and end points are equal. In such a case, the end y point is slightly increased to avoid the overlap.
NullPointerException | if midpoints array is null,
or colors array is null, |
---|---|
IllegalArgumentException | if start and end points are the same points,
or midpoints.length != colors.length ,
or colors is less than 2 in size,
or a midpoints value is less than 0.0 or greater than 1.0,
or the midpoints are not provided in strictly increasing order
|
Given parameters for creating a RadialGradientPaint, this method will create and return a radial gradient paint. One primary purpose for this method is to avoid creating a RadialGradientPaint where the radius is non-positive. In such a case, the radius is just slightly increased to avoid 0.
NullPointerException | if midpoints array is null,
or colors array is null |
---|---|
IllegalArgumentException | if r is non-positive,
or midpoints.length != colors.length ,
or colors is less than 2 in size,
or a midpoints value is less than 0.0 or greater than 1.0,
or the midpoints are not provided in strictly increasing order
|
Decodes and returns a float value representing the actual pixel location for the given encoded X value.
x | an encoded x value (0...1, or 1...2, or 2...3) |
---|
IllegalArgumentException | if x < 0 or x > 3
|
---|
Decodes and returns a float value representing the actual pixel location for the given encoded y value.
y | an encoded y value (0...1, or 1...2, or 2...3) |
---|
IllegalArgumentException | if y < 0 or y > 3
|
---|
Actually performs the painting operation. Subclasses must implement this method.
The graphics object passed may represent the actual surface being rendererd to,
or it may be an intermediate buffer. It has also been pre-translated. Simply render
the component as if it were located at 0, 0 and had a width of width
and a height of height
. For performance reasons, you may want to read
the clip from the Graphics2D object and only render within that space.
g | The Graphics2D surface to paint to |
---|---|
c | The JComponent related to the drawing event. For example, if the
region being rendered is Button, then c will be a
JButton. If the region being drawn is ScrollBarSlider, then the
component will be JScrollBar. This value may be null. |
width | The width of the region to paint. Note that in the case of painting the foreground, this value may differ from c.getWidth(). |
height | The height of the region to paint. Note that in the case of painting the foreground, this value may differ from c.getHeight(). |
extendedCacheKeys | The result of the call to getExtendedCacheKeys() |
Get a color property from the given JComponent. First checks for a
getXXX()
method and if that fails checks for a client
property with key property
. If that still fails to return
a Color then defaultColor
is returned.
c | The component to get the color property from |
---|---|
property | The name of a bean style property or client property |
defaultColor | The color to return if no color was obtained from the component. |
Get any extra attributes which the painter implementation would like to include in the image cache lookups. This is checked for every call of the paint(g, c, w, h) method.
c | The component on the current paint call |
---|
Gets the PaintContext for this painting operation. This method is called on every paint, and so should be fast and produce no garbage. The PaintContext contains information such as cache hints. It also contains data necessary for decoding points at runtime, such as the stretching insets, the canvas size at which the encoded points were defined, and whether the stretching insets are inverted.
This method allows for subclasses to package the painting of different states with possibly different canvas sizes, etc, into one AbstractRegionPainter implementation.