public class BorderStroke
extends java.lang.Object
Border
for styling a Region
.
The stroke is a vector-based rendering that outlines the border area.
It can be inset (or outset) from the Region
's edge, and the values
of the stroke are taken into account when computing the Region
's
insets (for defining the content area). The stroke visuals are not used when
any BorderImage
s are in use.
When applied to a Region
with a defined shape, the border width
and stroking information for the top
is used, while the other
attributes are ignored.
Modifier and Type | Field and Description |
---|---|
(package private) Paint |
bottomStroke |
(package private) BorderStrokeStyle |
bottomStyle |
static BorderWidths |
DEFAULT_WIDTHS
The default Insets to be used with a BorderStroke that does not
otherwise define any.
|
private int |
hash
A cached hash code
|
(package private) Insets |
innerEdge |
(package private) Insets |
insets |
(package private) Paint |
leftStroke |
(package private) BorderStrokeStyle |
leftStyle |
static BorderWidths |
MEDIUM
The default insets when "medium" is specified
|
(package private) Insets |
outerEdge |
private CornerRadii |
radii |
(package private) Paint |
rightStroke |
(package private) BorderStrokeStyle |
rightStyle |
private boolean |
strokeUniform |
static BorderWidths |
THICK
The default insets when "thick" is specified
|
static BorderWidths |
THIN
The default insets when "thin" is specified.
|
(package private) Paint |
topStroke |
(package private) BorderStrokeStyle |
topStyle |
(package private) BorderWidths |
widths |
Constructor and Description |
---|
BorderStroke(Paint stroke,
BorderStrokeStyle style,
CornerRadii radii,
BorderWidths widths)
Creates a new
BorderStroke . |
BorderStroke(Paint stroke,
BorderStrokeStyle style,
CornerRadii radii,
BorderWidths widths,
Insets insets)
Creates a new
BorderStroke . |
BorderStroke(Paint topStroke,
Paint rightStroke,
Paint bottomStroke,
Paint leftStroke,
BorderStrokeStyle topStyle,
BorderStrokeStyle rightStyle,
BorderStrokeStyle bottomStyle,
BorderStrokeStyle leftStyle,
CornerRadii radii,
BorderWidths widths,
Insets insets)
Creates a new
BorderStroke , specifying all construction parameters. |
Modifier and Type | Method and Description |
---|---|
private double |
computeInside(StrokeType type,
double width) |
private double |
computeOutside(StrokeType type,
double width) |
boolean |
equals(java.lang.Object o) |
Paint |
getBottomStroke()
Defines the fill of bottom side of this border.
|
BorderStrokeStyle |
getBottomStyle()
Defines the style of bottom side of this border.
|
Insets |
getInsets()
Defines the insets of each side of the
BorderStroke . |
Paint |
getLeftStroke()
Defines the fill of left side of this border.
|
BorderStrokeStyle |
getLeftStyle()
Defines the style of left side of this border.
|
CornerRadii |
getRadii()
Defines the radii for each corner of this
BorderStroke . |
Paint |
getRightStroke()
Defines the fill of right side of this border.
|
BorderStrokeStyle |
getRightStyle()
Defines the style of right side of this border.
|
Paint |
getTopStroke()
Defines the fill of top side of this border.
|
BorderStrokeStyle |
getTopStyle()
Defines the style of top side of this border.
|
BorderWidths |
getWidths()
Defines the thickness of each side of the
BorderStroke . |
int |
hashCode() |
boolean |
isStrokeUniform()
Checks if the stroke of this region is uniform.
|
private int |
preComputeHash() |
public static final BorderWidths THIN
public static final BorderWidths MEDIUM
public static final BorderWidths THICK
public static final BorderWidths DEFAULT_WIDTHS
final Paint topStroke
final Paint rightStroke
final Paint bottomStroke
final Paint leftStroke
final BorderStrokeStyle topStyle
final BorderStrokeStyle rightStyle
final BorderStrokeStyle bottomStyle
final BorderStrokeStyle leftStyle
final BorderWidths widths
final Insets insets
final Insets innerEdge
final Insets outerEdge
private final CornerRadii radii
private final boolean strokeUniform
private final int hash
public BorderStroke(Paint stroke, BorderStrokeStyle style, CornerRadii radii, BorderWidths widths)
BorderStroke
.stroke
- The stroke to use for all sides. If null
, defaults to Color.BLACK
.style
- The style to use for all sides. If null
, defaults to BorderStrokeStyle.NONE
.radii
- The radii to use. If null
, defaults to CornerRadii.EMPTY
.widths
- The widths to use. If null
, defaults to DEFAULT_WIDTHS
.public BorderStroke(Paint stroke, BorderStrokeStyle style, CornerRadii radii, BorderWidths widths, Insets insets)
BorderStroke
.stroke
- The stroke to use for all sides. If null
, defaults to Color.BLACK
.style
- The style to use for all sides. If null
, defaults to BorderStrokeStyle.NONE
.radii
- The radii to use. If null
, defaults to CornerRadii.EMPTY
.widths
- The widths to use. If null
, defaults to DEFAULT_WIDTHS
.insets
- The insets indicating where to draw the border relative to the region edges.
If null
, defaults to Insets.EMPTY
.public BorderStroke(Paint topStroke, Paint rightStroke, Paint bottomStroke, Paint leftStroke, BorderStrokeStyle topStyle, BorderStrokeStyle rightStyle, BorderStrokeStyle bottomStyle, BorderStrokeStyle leftStyle, CornerRadii radii, BorderWidths widths, Insets insets)
BorderStroke
, specifying all construction parameters.topStroke
- The fill to use on the top. If null
, defaults to Color.BLACK
.rightStroke
- The fill to use on the right. If null
, defaults to the same value as topStroke
.bottomStroke
- The fill to use on the bottom. If null
, defaults to the same value as topStroke
.leftStroke
- The fill to use on the left. If null
, defaults to the same value as rightStroke
.topStyle
- The style to use on the top. If null
, defaults to BorderStrokeStyle.NONE
.rightStyle
- The style to use on the right. If null
, defaults to the same value as topStyle
.bottomStyle
- The style to use on the bottom. If null
, defaults to the same value as topStyle
.leftStyle
- The style to use on the left. If null
, defaults to the same value as rightStyle
.radii
- The radii. If null
, defaults to square corners by using CornerRadii.EMPTY
.widths
- The thickness of each side. If null
, defaults to DEFAULT_WIDTHS
.insets
- The insets indicating where to draw the border relative to the region edges.
If null
, defaults to Insets.EMPTY
.public final Paint getTopStroke()
public final Paint getRightStroke()
null
, then the
topFill
is used.public final Paint getBottomStroke()
null
, then the
topFill
is used.public final Paint getLeftStroke()
null
, then the
rightFill
is used.public final BorderStrokeStyle getTopStyle()
public final BorderStrokeStyle getRightStyle()
null
, then
topStyle
is used;public final BorderStrokeStyle getBottomStyle()
null
, then
topStyle
is used; Use BorderStyle.NONE
to set the border to
have no border style.public final BorderStrokeStyle getLeftStyle()
null
, then
rightStyle
is used. Use BorderStyle.NONE
to set the border to
have no border style.public final BorderWidths getWidths()
BorderStroke
. This will never
be null
, and defaults to DEFAULT_WIDTHS
.BorderStroke
public final Insets getInsets()
BorderStroke
. This will never
be null
, and defaults to Insets.EMPTY
.BorderStroke
public final CornerRadii getRadii()
BorderStroke
. This will never
be null
, and defaults to CornerRadii.EMPTY
.BorderStroke
public final boolean isStrokeUniform()
true
if border stroke is uniformprivate int preComputeHash()
private double computeInside(StrokeType type, double width)
private double computeOutside(StrokeType type, double width)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object