Package com.github.tadukoo.view.border
Class ShapedBevelBorder
java.lang.Object
javax.swing.border.AbstractBorder
com.github.tadukoo.view.border.ShapedBevelBorder
- All Implemented Interfaces:
Serializable
,Border
Shaped Etched Border mimics the functionality of a
BevelBorder
, but uses the
ShapeInfo
(if present) on the component to draw the border, rather than making a rectangular border, or
it can have its own ShapeInfo
if desired.- Since:
- Alpha v.0.2
- Version:
- Alpha v.0.2.1
- Author:
- Logan Ferree (Tadukoo)
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enum representing the Bevel type to be used (RAISED or LOWERED) for a borderstatic class
Shaped Bevel Border Builder is used to create aShapedBevelBorder
. -
Field Summary
Modifier and TypeFieldDescriptionprivate final ShapedBevelBorder.BevelType
Thetype of bevel
(RAISED or LOWERED)private final SizablePaint
TheSizablePaint
for the inner highlightprivate final SizablePaint
TheSizablePaint
for the outer highlightprivate final SizablePaint
TheSizablePaint
for the inner shadowprivate final SizablePaint
TheSizablePaint
for the outer shadowprivate final ShapeInfo
TheShapeInfo
to use on the Border (may be null to use the component's shape) -
Constructor Summary
ModifierConstructorDescriptionprivate
ShapedBevelBorder
(ShapeInfo shapeInfo, ShapedBevelBorder.BevelType bevelType, SizablePaint highlightInnerPaint, SizablePaint highlightOuterPaint, SizablePaint shadowInnerPaint, SizablePaint shadowOuterPaint) Creates a new Shaped Bevel Border with the given parameters -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
getBorderInsets
(Component c, Insets insets) private Paint
getHighlightInnerPaint
(Component c, Dimension size) Returns aPaint
to use for the inner highlight on the given component with the given size.private Paint
getHighlightOuterPaint
(Component c, Dimension size) Returns aPaint
to use for the outer highlight on the given component with the given size.private Paint
getShadowInnerPaint
(Component c, Dimension size) Returns aPaint
to use for the inner shadow on the given component with the given size.private Paint
getShadowOuterPaint
(Component c, Dimension size) Returns aPaint
to use for the outer shadow on the given component with the given size.void
paintBorder
(Component c, Graphics g, int x, int y, int w, int h) private void
paintLoweredBevel
(Component c, Graphics g, int x, int y, int w, int h, ShapeInfo shapeInfo) Paints a lowered bevel for the specified component with the specified position and size.private void
paintRaisedBevel
(Component c, Graphics g, int x, int y, int w, int h, ShapeInfo shapeInfo) Paints a raised bevel for the specified component with the specified position and size.Methods inherited from class javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle, isBorderOpaque
-
Field Details
-
shapeInfo
TheShapeInfo
to use on the Border (may be null to use the component's shape) -
bevelType
Thetype of bevel
(RAISED or LOWERED) -
highlightInnerPaint
TheSizablePaint
for the inner highlight -
highlightOuterPaint
TheSizablePaint
for the outer highlight -
shadowInnerPaint
TheSizablePaint
for the inner shadow -
shadowOuterPaint
TheSizablePaint
for the outer shadow
-
-
Constructor Details
-
ShapedBevelBorder
private ShapedBevelBorder(ShapeInfo shapeInfo, ShapedBevelBorder.BevelType bevelType, SizablePaint highlightInnerPaint, SizablePaint highlightOuterPaint, SizablePaint shadowInnerPaint, SizablePaint shadowOuterPaint) Creates a new Shaped Bevel Border with the given parameters- Parameters:
shapeInfo
- TheShapeInfo
to use on the Border (may be null to use the component's shape)bevelType
- Thetype of bevel
(RAISED or LOWERED)highlightInnerPaint
- TheSizablePaint
for the inner highlighthighlightOuterPaint
- TheSizablePaint
for the outer highlightshadowInnerPaint
- TheSizablePaint
for the inner shadowshadowOuterPaint
- TheSizablePaint
for the outer shadow
-
-
Method Details
-
builder
- Returns:
- A
builder
to create aShapedBevelBorder
-
getBorderInsets
- Specified by:
getBorderInsets
in interfaceBorder
- Overrides:
getBorderInsets
in classAbstractBorder
-
getBorderInsets
- Overrides:
getBorderInsets
in classAbstractBorder
-
paintBorder
- Specified by:
paintBorder
in interfaceBorder
- Overrides:
paintBorder
in classAbstractBorder
-
paintRaisedBevel
private void paintRaisedBevel(Component c, Graphics g, int x, int y, int w, int h, ShapeInfo shapeInfo) Paints a raised bevel for the specified component with the specified position and size.- Parameters:
c
- the component for which the bevel is being paintedg
- the paint graphicsx
- the x position of the bevely
- the y position of the bevelw
- the width of the bevelh
- the height of the bevelshapeInfo
- TheShapeInfo
to use for the bevel
-
paintLoweredBevel
private void paintLoweredBevel(Component c, Graphics g, int x, int y, int w, int h, ShapeInfo shapeInfo) Paints a lowered bevel for the specified component with the specified position and size.- Parameters:
c
- the component for which the lowered bevel is being paintedg
- the paint graphicsx
- the x position of the lowered bevely
- the y position of the lowered bevelw
- the width of the lowered bevelh
- the height of the lowered bevelshapeInfo
- TheShapeInfo
to use for the bevel
-
getHighlightInnerPaint
Returns aPaint
to use for the inner highlight on the given component with the given size. -
getHighlightOuterPaint
Returns aPaint
to use for the outer highlight on the given component with the given size. -
getShadowInnerPaint
Returns aPaint
to use for the inner shadow on the given component with the given size. -
getShadowOuterPaint
Returns aPaint
to use for the outer shadow on the given component with the given size.
-