APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.nimbus

public abstract Class AbstractRegionPainter

extends Object
implements Painter<JComponent>
Class Inheritance
All Implemented Interfaces
javax.swing.Painter
Known Direct Subclasses
javax.swing.plaf.nimbus.LoweredBorder, javax.swing.plaf.nimbus.ToolBarSeparatorPainter, javax.swing.plaf.nimbus.ArrowButtonPainter, javax.swing.plaf.nimbus.ButtonPainter, javax.swing.plaf.nimbus.CheckBoxMenuItemPainter, javax.swing.plaf.nimbus.CheckBoxPainter, javax.swing.plaf.nimbus.ComboBoxArrowButtonPainter, javax.swing.plaf.nimbus.ComboBoxPainter, javax.swing.plaf.nimbus.ComboBoxTextFieldPainter, javax.swing.plaf.nimbus.DesktopIconPainter, javax.swing.plaf.nimbus.DesktopPanePainter, javax.swing.plaf.nimbus.EditorPanePainter, javax.swing.plaf.nimbus.FileChooserPainter, javax.swing.plaf.nimbus.FormattedTextFieldPainter, javax.swing.plaf.nimbus.InternalFramePainter, javax.swing.plaf.nimbus.InternalFrameTitlePaneCloseButtonPainter, javax.swing.plaf.nimbus.InternalFrameTitlePaneIconifyButtonPainter, javax.swing.plaf.nimbus.InternalFrameTitlePaneMaximizeButtonPainter, javax.swing.plaf.nimbus.InternalFrameTitlePaneMenuButtonPainter, javax.swing.plaf.nimbus.InternalFrameTitlePanePainter, javax.swing.plaf.nimbus.MenuBarMenuPainter, javax.swing.plaf.nimbus.MenuBarPainter, javax.swing.plaf.nimbus.MenuPainter, javax.swing.plaf.nimbus.OptionPaneMessageAreaOptionPaneLabelPainter, javax.swing.plaf.nimbus.OptionPaneMessageAreaPainter, javax.swing.plaf.nimbus.OptionPanePainter, javax.swing.plaf.nimbus.PasswordFieldPainter, javax.swing.plaf.nimbus.PopupMenuPainter, javax.swing.plaf.nimbus.PopupMenuSeparatorPainter, javax.swing.plaf.nimbus.ProgressBarPainter, javax.swing.plaf.nimbus.RadioButtonMenuItemPainter, javax.swing.plaf.nimbus.RadioButtonPainter, javax.swing.plaf.nimbus.ScrollBarButtonPainter, javax.swing.plaf.nimbus.ScrollBarPainter, javax.swing.plaf.nimbus.ScrollBarThumbPainter, javax.swing.plaf.nimbus.ScrollPanePainter, javax.swing.plaf.nimbus.SeparatorPainter, javax.swing.plaf.nimbus.SliderPainter, javax.swing.plaf.nimbus.SliderThumbPainter, javax.swing.plaf.nimbus.SliderTrackPainter, javax.swing.plaf.nimbus.SpinnerNextButtonPainter, javax.swing.plaf.nimbus.SpinnerPainter, javax.swing.plaf.nimbus.SpinnerPanelSpinnerFormattedTextFieldPainter, javax.swing.plaf.nimbus.SpinnerPreviousButtonPainter, javax.swing.plaf.nimbus.SplitPaneDividerPainter, javax.swing.plaf.nimbus.MenuItemPainter, javax.swing.plaf.nimbus.ScrollBarTrackPainter, javax.swing.plaf.nimbus.SplitPanePainter, javax.swing.plaf.nimbus.TabbedPanePainter, javax.swing.plaf.nimbus.TabbedPaneTabAreaPainter, javax.swing.plaf.nimbus.TabbedPaneTabPainter, javax.swing.plaf.nimbus.TableEditorPainter, javax.swing.plaf.nimbus.TableHeaderPainter, javax.swing.plaf.nimbus.TableHeaderRendererPainter, javax.swing.plaf.nimbus.TextAreaPainter, javax.swing.plaf.nimbus.TextFieldPainter, javax.swing.plaf.nimbus.TextPanePainter, javax.swing.plaf.nimbus.ToggleButtonPainter, javax.swing.plaf.nimbus.ToolBarButtonPainter, javax.swing.plaf.nimbus.ToolBarPainter, javax.swing.plaf.nimbus.ToolBarToggleButtonPainter, javax.swing.plaf.nimbus.ToolTipPainter, javax.swing.plaf.nimbus.TreeCellEditorPainter, javax.swing.plaf.nimbus.TreeCellPainter, javax.swing.plaf.nimbus.TreePainter
Imports
java.awt.*, java.awt.image.*, java.lang.reflect.Method, javax.swing.*, .Painter, javax.swing.plaf.UIResource, java.awt.print.PrinterGraphics, sun.reflect.misc.MethodUtil

Convenient base class for defining Painter instances for rendering a region or component in Nimbus.
Authors
Jasper Potts, Richard Bair

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
AbstractRegionPainter.PaintContext

A class encapsulating state useful when painting.

Field Summary

Modifier and TypeField and Description
private float
bottomHeight

The height of the bottom section.

private float
bottomScale

The scaling factor to use for the bottom section.

private float
centerHeight

The height of the center section.

private float
centerHScale

The scaling factor to use for the center section, in the horizontal direction.

private float
centerVScale

The scaling factor to use for the center section, in the vertical direction.

private float
centerWidth

The width of the center section.

private AbstractRegionPainter.PaintContext
ctx

PaintContext, which holds a lot of the state needed for cache hinting and x/y value decoding The data contained within the context is typically only computed once and reused over multiple paint calls, whereas the other values (w, h, f, leftWidth, etc) are recomputed for each call to paint.

private float
f

The scaling factor.

private float
leftScale

The scaling factor to use for the left section.

private float
leftWidth

The width of the left section.

private float
rightScale

The scaling factor to use for the right section.

private float
rightWidth

The width of the right section.

private float
topHeight

The height of the top section.

private float
topScale

The scaling factor to use for the top section.

Constructor Summary

AccessConstructor and Description
protected
AbstractRegionPainter()

Create a new AbstractRegionPainter

Method Summary

Modifier and TypeMethod and Description
private float
clamp(float value)

private int
clamp(int value)

protected void
configureGraphics(Graphics2D
The Graphics2D object to configure. Will not be null.
g
)

Configures the given Graphics2D.

protected final float

Returns:

the decoded x location of the control point
decodeAnchorX
(float
an encoded x value of the bezier control point (0...1, or 1...2, or 2...3)
x
,
float
the offset distance to the anchor from the control point x
dx
)

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.

protected final float

Returns:

the decoded y position of the control point
decodeAnchorY
(float
an encoded y value of the bezier control point (0...1, or 1...2, or 2...3)
y
,
float
the offset distance to the anchor from the control point y
dy
)

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.

protected final Color

Returns:

The derived color, whose color value will change if the parent uiDefault color changes.
decodeColor
(String
A key corresponding to the value in the UI Defaults table of UIManager where the base color is defined
key
,
float
The hue offset used for derivation.
hOffset
,
float
The saturation offset used for derivation.
sOffset
,
float
The brightness offset used for derivation.
bOffset
,
int
The alpha offset used for derivation. Between 0...255
aOffset
)

Decodes and returns a color, which is derived from a base color in UI defaults.

protected final Color

Returns:

The derived color
decodeColor
(Color
The first color
color1
,
Color
The second color
color2
,
float
The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2;
midPoint
)

Decodes and returns a color, which is derived from a offset between two other colors.

protected final LinearGradientPaint

Returns:

a valid LinearGradientPaint. This method never returns null.
decodeGradient
(float
x1
x1
,
float
y1
y1
,
float
x2
x2
,
float
y2
y2
,
float[]
the midpoints
midpoints
,
Color[]
the colors
colors
)

Given parameters for creating a LinearGradientPaint, this method will create and return a linear gradient paint.

protected final RadialGradientPaint

Returns:

a valid RadialGradientPaint. This method never returns null.
decodeRadialGradient
(float
x-coordinate
x
,
float
y-coordinate
y
,
float
radius
r
,
float[]
the midpoints
midpoints
,
Color[]
the colors
colors
)

Given parameters for creating a RadialGradientPaint, this method will create and return a radial gradient paint.

protected final float

Returns:

the decoded x value
decodeX
(float
an encoded x value (0...1, or 1...2, or 2...3)
x
)

Decodes and returns a float value representing the actual pixel location for the given encoded X value.

protected final float

Returns:

the decoded y value
decodeY
(float
an encoded y value (0...1, or 1...2, or 2...3)
y
)

Decodes and returns a float value representing the actual pixel location for the given encoded y value.

protected abstract void
doPaint(Graphics2D
The Graphics2D surface to paint to
g
,
JComponent
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.
c
,
int
The width of the region to paint. Note that in the case of painting the foreground, this value may differ from c.getWidth().
width
,
int
The height of the region to paint. Note that in the case of painting the foreground, this value may differ from c.getHeight().
height
,
Object[]
The result of the call to getExtendedCacheKeys()
extendedCacheKeys
)

Actually performs the painting operation.

protected final Color

Returns:

The color that was obtained from the component or defaultColor
getComponentColor
(JComponent
The component to get the color property from
c
,
String
The name of a bean style property or client property
property
,
Color
The color to return if no color was obtained from the component.
defaultColor
,
float
additively modifies the HSB saturation component of the color returned (ignored if default color is returned).
saturationOffset
,
float
additively modifies the HSB brightness component of the color returned (ignored if default color is returned).
brightnessOffset
,
int
additively modifies the ARGB alpha component of the color returned (ignored if default color is returned).
alphaOffset
)

Get a color property from the given JComponent.

protected Object[]

Returns:

Array of extra objects to be included in the cache key
getExtendedCacheKeys
(JComponent
The component on the current paint call
c
)

Get any extra attributes which the painter implementation would like to include in the image cache lookups.

private VolatileImage
getImage(GraphicsConfiguration config, JComponent c, int w, int h, Object[] extendedCacheKeys)

Gets the rendered image for this painter at the requested size, either from cache or create a new one

protected abstract AbstractRegionPainter.PaintContext

Returns:

a PaintContext associated with this paint operation.
getPaintContext
()

Gets the PaintContext for this painting operation.

public final void
paint(Graphics2D g, JComponent c, int w, int h)

Implements javax.swing.Painter.paint.

Renders to the given java.awt.Graphics2D object.

private void
paint0(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys)

private void
private void
paintWithFixedSizeCaching(Graphics2D g, JComponent c, int w, int h, Object[] extendedCacheKeys)

private void
prepare(float w, float h)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bottomHeightback to summary
private float bottomHeight

The height of the bottom section. Recomputed on each call to paint.

bottomScaleback to summary
private float bottomScale

The scaling factor to use for the bottom section. Recomputed on each call to paint.

centerHeightback to summary
private float centerHeight

The height of the center section. Recomputed on each call to paint.

centerHScaleback to summary
private float centerHScale

The scaling factor to use for the center section, in the horizontal direction. Recomputed on each call to paint.

centerVScaleback to summary
private float centerVScale

The scaling factor to use for the center section, in the vertical direction. Recomputed on each call to paint.

centerWidthback to summary
private float centerWidth

The width of the center section. Recomputed on each call to paint.

ctxback to summary
private AbstractRegionPainter.PaintContext ctx

PaintContext, which holds a lot of the state needed for cache hinting and x/y value decoding The data contained within the context is typically only computed once and reused over multiple paint calls, whereas the other values (w, h, f, leftWidth, etc) are recomputed for each call to paint. This field is retrieved from subclasses on each paint operation. It is up to the subclass to compute and cache the PaintContext over multiple calls.

fback to summary
private float f

The scaling factor. Recomputed on each call to paint.

leftScaleback to summary
private float leftScale

The scaling factor to use for the left section. Recomputed on each call to paint.

leftWidthback to summary
private float leftWidth

The width of the left section. Recomputed on each call to paint.

rightScaleback to summary
private float rightScale

The scaling factor to use for the right section. Recomputed on each call to paint.

rightWidthback to summary
private float rightWidth

The width of the right section. Recomputed on each call to paint.

topHeightback to summary
private float topHeight

The height of the top section. Recomputed on each call to paint.

topScaleback to summary
private float topScale

The scaling factor to use for the top section. Recomputed on each call to paint.

Constructor Detail

AbstractRegionPainterback to summary
protected AbstractRegionPainter()

Create a new AbstractRegionPainter

Method Detail

clampback to summary
private float clamp(float value)
clampback to summary
private int clamp(int value)
configureGraphicsback to summary
protected void configureGraphics(Graphics2D g)

Configures the given Graphics2D. Often, rendering hints or compositing 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.

Parameters
g:Graphics2D

The Graphics2D object to configure. Will not be null.

decodeAnchorXback to summary
protected final float decodeAnchorX(float x, float dx)

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.

Parameters
x:float

an encoded x value of the bezier control point (0...1, or 1...2, or 2...3)

dx:float

the offset distance to the anchor from the control point x

Returns:float

the decoded x location of the control point

Exceptions
IllegalArgumentException:
if x < 0 or x > 3
decodeAnchorYback to summary
protected final float decodeAnchorY(float y, float dy)

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.

Parameters
y:float

an encoded y value of the bezier control point (0...1, or 1...2, or 2...3)

dy:float

the offset distance to the anchor from the control point y

Returns:float

the decoded y position of the control point

Exceptions
IllegalArgumentException:
if y < 0 or y > 3
decodeColorback to summary
protected final Color decodeColor(String key, float hOffset, float sOffset, float bOffset, int aOffset)

Decodes and returns a color, which is derived from a base color in UI defaults.

Parameters
key:String

A key corresponding to the value in the UI Defaults table of UIManager where the base color is defined

hOffset:float

The hue offset used for derivation.

sOffset:float

The saturation offset used for derivation.

bOffset:float

The brightness offset used for derivation.

aOffset:int

The alpha offset used for derivation. Between 0...255

Returns:Color

The derived color, whose color value will change if the parent uiDefault color changes.

decodeColorback to summary
protected final Color decodeColor(Color color1, Color color2, float midPoint)

Decodes and returns a color, which is derived from a offset between two other colors.

Parameters
color1:Color

The first color

color2:Color

The second color

midPoint:float

The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2;

Returns:Color

The derived color

decodeGradientback to summary
protected final LinearGradientPaint decodeGradient(float x1, float y1, float x2, float y2, float[] midpoints, Color[] colors)

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.

Parameters
x1:float

x1

y1:float

y1

x2:float

x2

y2:float

y2

midpoints:float[]

the midpoints

colors:Color[]

the colors

Returns:LinearGradientPaint

a valid LinearGradientPaint. This method never returns null.

Exceptions
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
decodeRadialGradientback to summary
protected final RadialGradientPaint decodeRadialGradient(float x, float y, float r, float[] midpoints, Color[] colors)

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.

Parameters
x:float

x-coordinate

y:float

y-coordinate

r:float

radius

midpoints:float[]

the midpoints

colors:Color[]

the colors

Returns:RadialGradientPaint

a valid RadialGradientPaint. This method never returns null.

Exceptions
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
decodeXback to summary
protected final float decodeX(float x)

Decodes and returns a float value representing the actual pixel location for the given encoded X value.

Parameters
x:float

an encoded x value (0...1, or 1...2, or 2...3)

Returns:float

the decoded x value

Exceptions
IllegalArgumentException:
if x < 0 or x > 3
decodeYback to summary
protected final float decodeY(float y)

Decodes and returns a float value representing the actual pixel location for the given encoded y value.

Parameters
y:float

an encoded y value (0...1, or 1...2, or 2...3)

Returns:float

the decoded y value

Exceptions
IllegalArgumentException:
if y < 0 or y > 3
doPaintback to summary
protected abstract void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys)

Actually performs the painting operation. Subclasses must implement this method. The graphics object passed may represent the actual surface being rendered 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.

Parameters
g:Graphics2D

The Graphics2D surface to paint to

c:JComponent

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:int

The width of the region to paint. Note that in the case of painting the foreground, this value may differ from c.getWidth().

height:int

The height of the region to paint. Note that in the case of painting the foreground, this value may differ from c.getHeight().

extendedCacheKeys:Object[]

The result of the call to getExtendedCacheKeys()

getComponentColorback to summary
protected final Color getComponentColor(JComponent c, String property, Color defaultColor, float saturationOffset, float brightnessOffset, int alphaOffset)

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.

Parameters
c:JComponent

The component to get the color property from

property:String

The name of a bean style property or client property

defaultColor:Color

The color to return if no color was obtained from the component.

saturationOffset:float

additively modifies the HSB saturation component of the color returned (ignored if default color is returned).

brightnessOffset:float

additively modifies the HSB brightness component of the color returned (ignored if default color is returned).

alphaOffset:int

additively modifies the ARGB alpha component of the color returned (ignored if default color is returned).

Returns:Color

The color that was obtained from the component or defaultColor

getExtendedCacheKeysback to summary
protected Object[] getExtendedCacheKeys(JComponent c)

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.

Parameters
c:JComponent

The component on the current paint call

Returns:Object[]

Array of extra objects to be included in the cache key

getImageback to summary
private VolatileImage getImage(GraphicsConfiguration config, JComponent c, int w, int h, Object[] extendedCacheKeys)

Gets the rendered image for this painter at the requested size, either from cache or create a new one

getPaintContextback to summary
protected abstract AbstractRegionPainter.PaintContext getPaintContext()

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.

Returns:AbstractRegionPainter.PaintContext

a PaintContext associated with this paint operation.

paintback to summary
public final void paint(Graphics2D g, JComponent c, int w, int h)

Implements javax.swing.Painter.paint.

Doc from javax.swing.Painter.paint.

Renders to the given java.awt.Graphics2D object. Implementations of this method may modify state on the Graphics2D, and are not required to restore that state upon completion. In most cases, it is recommended that the caller pass in a scratch graphics object. The Graphics2D must never be null.

State on the graphics object may be honored by the paint method, but may not be. For instance, setting the antialiasing rendering hint on the graphics may or may not be respected by the Painter implementation.

The supplied object parameter acts as an optional configuration argument. For example, it could be of type Component. A Painter that expected it could then read state from that Component and use the state for painting. For example, an implementation may read the backgroundColor and use that.

Generally, to enhance reusability, most standard Painters ignore this parameter. They can thus be reused in any context. The object may be null. Implementations must not throw a NullPointerException if the object parameter is null.

Finally, the width and height arguments specify the width and height that the Painter should paint into. More specifically, the specified width and height instruct the painter that it should paint fully within this width and height. Any specified clip on the g param will further constrain the region.

For example, suppose I have a Painter implementation that draws a gradient. The gradient goes from white to black. It "stretches" to fill the painted region. Thus, if I use this Painter to paint a 500 x 500 region, the far left would be black, the far right would be white, and a smooth gradient would be painted between. I could then, without modification, reuse the Painter to paint a region that is 20x20 in size. This region would also be black on the left, white on the right, and a smooth gradient painted between.

Annotations
@Override
paint0back to summary
private void paint0(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys)
paintWith9SquareCachingback to summary
private void paintWith9SquareCaching(Graphics2D g, AbstractRegionPainter.PaintContext ctx, JComponent c, int w, int h, Object[] extendedCacheKeys)
paintWithFixedSizeCachingback to summary
private void paintWithFixedSizeCaching(Graphics2D g, JComponent c, int w, int h, Object[] extendedCacheKeys)
prepareback to summary
private void prepare(float w, float h)
javax.swing.plaf.nimbus back to summary

protected Class AbstractRegionPainter.PaintContext

extends Object
Class Inheritance

A class encapsulating state useful when painting. Generally, instances of this class are created once, and reused for each paint request without modification. This class contains values useful when hinting the cache engine, and when decoding control points and bezier curve anchors.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static enum

Field Summary

Modifier and TypeField and Description
private float
a

private float
private float
b

private float
private float
c

private AbstractRegionPainter.PaintContext.CacheMode
private Dimension
private float
private float
d

private float
private static Insets
private boolean
private double
private double
private Insets

Constructor Summary

AccessConstructor and Description
public
PaintContext(Insets
The stretching insets. May be null. If null, then assumed to be 0, 0, 0, 0.
insets
,
Dimension
The size of the canvas used when encoding the various x/y values. May be null. If null, then it is assumed that there are no encoded values, and any calls to one of the "decode" methods will return the passed in value.
canvasSize
,
boolean
Whether to "invert" the meaning of the 9-square grid and stretching insets
inverted
)

Creates a new PaintContext which does not attempt to cache or scale any cached images.

public
PaintContext(Insets
The stretching insets. May be null. If null, then assumed to be 0, 0, 0, 0.
insets
,
Dimension
The size of the canvas used when encoding the various x/y values. May be null. If null, then it is assumed that there are no encoded values, and any calls to one of the "decode" methods will return the passed in value.
canvasSize
,
boolean
Whether to "invert" the meaning of the 9-square grid and stretching insets
inverted
,
AbstractRegionPainter.PaintContext.CacheMode
A hint as to which caching mode to use. If null, then set to no caching.
cacheMode
,
double
The maximum scale in the horizontal direction to use before punting and redrawing from scratch. For example, if maxH is 2, then we will attempt to scale any cached images up to 2x the canvas width before redrawing from scratch. Reasonable maxH values may improve painting performance. If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1.
maxH
,
double
The maximum scale in the vertical direction to use before punting and redrawing from scratch. For example, if maxV is 2, then we will attempt to scale any cached images up to 2x the canvas height before redrawing from scratch. Reasonable maxV values may improve painting performance. If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1.
maxV
)

Creates a new PaintContext.

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aback to summary
private float a
aPercentback to summary
private float aPercent
bback to summary
private float b
bPercentback to summary
private float bPercent
cback to summary
private float c
cacheModeback to summary
private AbstractRegionPainter.PaintContext.CacheMode cacheMode
canvasSizeback to summary
private Dimension canvasSize
cPercentback to summary
private float cPercent
dback to summary
private float d
dPercentback to summary
private float dPercent
EMPTY_INSETSback to summary
private static Insets EMPTY_INSETS
invertedback to summary
private boolean inverted
maxHorizontalScaleFactorback to summary
private double maxHorizontalScaleFactor
maxVerticalScaleFactorback to summary
private double maxVerticalScaleFactor
stretchingInsetsback to summary
private Insets stretchingInsets

Constructor Detail

PaintContextback to summary
public PaintContext(Insets insets, Dimension canvasSize, boolean inverted)

Creates a new PaintContext which does not attempt to cache or scale any cached images.

Parameters
insets:Insets

The stretching insets. May be null. If null, then assumed to be 0, 0, 0, 0.

canvasSize:Dimension

The size of the canvas used when encoding the various x/y values. May be null. If null, then it is assumed that there are no encoded values, and any calls to one of the "decode" methods will return the passed in value.

inverted:boolean

Whether to "invert" the meaning of the 9-square grid and stretching insets

PaintContextback to summary
public PaintContext(Insets insets, Dimension canvasSize, boolean inverted, AbstractRegionPainter.PaintContext.CacheMode cacheMode, double maxH, double maxV)

Creates a new PaintContext.

Parameters
insets:Insets

The stretching insets. May be null. If null, then assumed to be 0, 0, 0, 0.

canvasSize:Dimension

The size of the canvas used when encoding the various x/y values. May be null. If null, then it is assumed that there are no encoded values, and any calls to one of the "decode" methods will return the passed in value.

inverted:boolean

Whether to "invert" the meaning of the 9-square grid and stretching insets

cacheMode:AbstractRegionPainter.PaintContext.CacheMode

A hint as to which caching mode to use. If null, then set to no caching.

maxH:double

The maximum scale in the horizontal direction to use before punting and redrawing from scratch. For example, if maxH is 2, then we will attempt to scale any cached images up to 2x the canvas width before redrawing from scratch. Reasonable maxH values may improve painting performance. If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1.

maxV:double

The maximum scale in the vertical direction to use before punting and redrawing from scratch. For example, if maxV is 2, then we will attempt to scale any cached images up to 2x the canvas height before redrawing from scratch. Reasonable maxV values may improve painting performance. If set too high, then you may get poor looking graphics at higher zoom levels. Must be >= 1.

javax.swing.plaf.nimbus back to summary

protected final Enum AbstractRegionPainter.PaintContext.CacheMode

extends Enum<AbstractRegionPainter.PaintContext.CacheMode>
Class Inheritance

Cache mode.

Field Summary

Modifier and TypeField and Description
public static final AbstractRegionPainter.PaintContext.CacheMode
FIXED_SIZES

Fixed sizes.

public static final AbstractRegionPainter.PaintContext.CacheMode
NINE_SQUARE_SCALE

Nine square scale.

public static final AbstractRegionPainter.PaintContext.CacheMode
NO_CACHING

No caching.

Constructor Summary

AccessConstructor and Description
private

Field Detail

FIXED_SIZESback to summary
public static final AbstractRegionPainter.PaintContext.CacheMode FIXED_SIZES

Fixed sizes.

NINE_SQUARE_SCALEback to summary
public static final AbstractRegionPainter.PaintContext.CacheMode NINE_SQUARE_SCALE

Nine square scale.

NO_CACHINGback to summary
public static final AbstractRegionPainter.PaintContext.CacheMode NO_CACHING

No caching.

Constructor Detail

CacheModeback to summary
private CacheMode()

Method Detail

valueOfback to summary
public static AbstractRegionPainter.PaintContext.CacheMode valueOf(String name)
valuesback to summary
public static AbstractRegionPainter.PaintContext.CacheMode[] values()