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

pack-priv Class LoweredBorder

extends AbstractRegionPainter
implements Border
Class Inheritance
All Implemented Interfaces
javax.swing.border.Border
Imports
javax.swing.border.Border, javax.swing.JComponent, java.awt.Insets, .Component, .Graphics, .Graphics2D, .Color, .RenderingHints, .Dimension, java.awt.image.BufferedImage

LoweredBorder - A recessed rounded inner shadowed border. Used as the standard Nimbus TitledBorder. This class is both a painter and a swing border.
Author
Jasper Potts

Field Summary

Modifier and TypeField and Description
private static final int
private static final Insets
private static final AbstractRegionPainter.PaintContext
private static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected 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[] extendedCacheKeys)

Implements abstract javax.swing.plaf.nimbus.AbstractRegionPainter.doPaint.

Actually performs the painting operation.

public Insets
getBorderInsets(Component
the component for which this border insets value applies
c
)

Implements javax.swing.border.Border.getBorderInsets.

Returns the insets of the border.

protected Object[]
getExtendedCacheKeys(JComponent c)

Overrides javax.swing.plaf.nimbus.AbstractRegionPainter.getExtendedCacheKeys.

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

private Color
getLighter(Color c, float factor)

protected AbstractRegionPainter.PaintContext

Returns:

a PaintContext associated with this paint operation.
getPaintContext
()

Implements abstract javax.swing.plaf.nimbus.AbstractRegionPainter.getPaintContext.

Gets the PaintContext for this painting operation.

public boolean
isBorderOpaque()

Implements javax.swing.border.Border.isBorderOpaque.

Returns whether or not the border is opaque.

public void
paintBorder(Component
the component for which this border is being painted
c
,
Graphics
the paint graphics
g
,
int
the x position of the painted border
x
,
int
the y position of the painted border
y
,
int
the width of the painted border
width
,
int
the height of the painted border
height
)

Implements javax.swing.border.Border.paintBorder.

Paints the border for the specified component with the specified position and size.

Inherited from javax.swing.plaf.nimbus.AbstractRegionPainter:
configureGraphicsdecodeAnchorXdecodeAnchorYdecodeColordecodeColordecodeGradientdecodeRadialGradientdecodeXdecodeYgetComponentColorpaint

Field Detail

IMG_SIZEback to summary
private static final int IMG_SIZE
INSETSback to summary
private static final Insets INSETS
PAINT_CONTEXTback to summary
private static final AbstractRegionPainter.PaintContext PAINT_CONTEXT
RADIUSback to summary
private static final int RADIUS

Constructor Detail

LoweredBorderback to summary
pack-priv LoweredBorder()

Method Detail

doPaintback to summary
protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys)

Implements abstract javax.swing.plaf.nimbus.AbstractRegionPainter.doPaint.

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().

getBorderInsetsback to summary
public Insets getBorderInsets(Component c)

Implements javax.swing.border.Border.getBorderInsets.

Returns the insets of the border.

Parameters
c:Component

the component for which this border insets value applies

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

Overrides javax.swing.plaf.nimbus.AbstractRegionPainter.getExtendedCacheKeys.

Doc from javax.swing.plaf.nimbus.AbstractRegionPainter.getExtendedCacheKeys.

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.

Annotations
@Override
getLighterback to summary
private Color getLighter(Color c, float factor)
getPaintContextback to summary
protected AbstractRegionPainter.PaintContext getPaintContext()

Implements abstract javax.swing.plaf.nimbus.AbstractRegionPainter.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.

isBorderOpaqueback to summary
public boolean isBorderOpaque()

Implements javax.swing.border.Border.isBorderOpaque.

Returns whether or not the border is opaque. If the border is opaque, it is responsible for filling in it's own background when painting.

paintBorderback to summary
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)

Implements javax.swing.border.Border.paintBorder.

Paints the border for the specified component with the specified position and size.

Parameters
c:Component

the component for which this border is being painted

g:Graphics

the paint graphics

x:int

the x position of the painted border

y:int

the y position of the painted border

width:int

the width of the painted border

height:int

the height of the painted border