java.lang.Object
javafx.scene.layout.BorderStroke
Defines the stroke to use on a
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.
- Since:
- JavaFX 8.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BorderWidths
The default Insets to be used with a BorderStroke that does not otherwise define any.static final BorderWidths
The default insets when "medium" is specifiedstatic final BorderWidths
The default insets when "thick" is specifiedstatic final BorderWidths
The default insets when "thin" is specified. -
Constructor Summary
ConstructorDescriptionBorderStroke
(Paint stroke, BorderStrokeStyle style, CornerRadii radii, BorderWidths widths) Creates a newBorderStroke
.BorderStroke
(Paint stroke, BorderStrokeStyle style, CornerRadii radii, BorderWidths widths, Insets insets) Creates a newBorderStroke
.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 newBorderStroke
, specifying all construction parameters. -
Method Summary
Modifier and TypeMethodDescriptionfinal Paint
Defines the fill of bottom side of this border.final BorderStrokeStyle
Defines the style of bottom side of this border.final Insets
Defines the insets of each side of theBorderStroke
.final Paint
Defines the fill of left side of this border.final BorderStrokeStyle
Defines the style of left side of this border.final CornerRadii
getRadii()
Defines the radii for each corner of thisBorderStroke
.final Paint
Defines the fill of right side of this border.final BorderStrokeStyle
Defines the style of right side of this border.final Paint
Defines the fill of top side of this border.final BorderStrokeStyle
Defines the style of top side of this border.final BorderWidths
Defines the thickness of each side of theBorderStroke
.final boolean
Checks if the stroke of this region is uniform.
-
Field Details
-
THIN
The default insets when "thin" is specified. -
MEDIUM
The default insets when "medium" is specified -
THICK
The default insets when "thick" is specified -
DEFAULT_WIDTHS
The default Insets to be used with a BorderStroke that does not otherwise define any.
-
-
Constructor Details
-
BorderStroke
Creates a newBorderStroke
.- Parameters:
stroke
- The stroke to use for all sides. Ifnull
, defaults toColor.BLACK
.style
- The style to use for all sides. Ifnull
, defaults toBorderStrokeStyle.NONE
.radii
- The radii to use. Ifnull
, defaults toCornerRadii.EMPTY
.widths
- The widths to use. Ifnull
, defaults toDEFAULT_WIDTHS
.
-
BorderStroke
public BorderStroke(Paint stroke, BorderStrokeStyle style, CornerRadii radii, BorderWidths widths, Insets insets) Creates a newBorderStroke
.- Parameters:
stroke
- The stroke to use for all sides. Ifnull
, defaults toColor.BLACK
.style
- The style to use for all sides. Ifnull
, defaults toBorderStrokeStyle.NONE
.radii
- The radii to use. Ifnull
, defaults toCornerRadii.EMPTY
.widths
- The widths to use. Ifnull
, defaults toDEFAULT_WIDTHS
.insets
- The insets indicating where to draw the border relative to the region edges. Ifnull
, defaults toInsets.EMPTY
.
-
BorderStroke
public 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 newBorderStroke
, specifying all construction parameters.- Parameters:
topStroke
- The fill to use on the top. Ifnull
, defaults toColor.BLACK
.rightStroke
- The fill to use on the right. Ifnull
, defaults to the same value astopStroke
.bottomStroke
- The fill to use on the bottom. Ifnull
, defaults to the same value astopStroke
.leftStroke
- The fill to use on the left. Ifnull
, defaults to the same value asrightStroke
.topStyle
- The style to use on the top. Ifnull
, defaults toBorderStrokeStyle.NONE
.rightStyle
- The style to use on the right. Ifnull
, defaults to the same value astopStyle
.bottomStyle
- The style to use on the bottom. Ifnull
, defaults to the same value astopStyle
.leftStyle
- The style to use on the left. Ifnull
, defaults to the same value asrightStyle
.radii
- The radii. Ifnull
, defaults to square corners by usingCornerRadii.EMPTY
.widths
- The thickness of each side. Ifnull
, defaults toDEFAULT_WIDTHS
.insets
- The insets indicating where to draw the border relative to the region edges. Ifnull
, defaults toInsets.EMPTY
.
-
-
Method Details
-
getTopStroke
Defines the fill of top side of this border.- Default value:
Color.BLACK
- Returns:
- the fill of top side of this border
-
getRightStroke
Defines the fill of right side of this border. Ifnull
, then thetopFill
is used.- Default value:
null
(same astopFill
)- Returns:
- the fill of right side of this border
-
getBottomStroke
Defines the fill of bottom side of this border. Ifnull
, then thetopFill
is used.- Default value:
null
(same astopFill
)- Returns:
- the fill of bottom side of this border
-
getLeftStroke
Defines the fill of left side of this border. Ifnull
, then therightFill
is used.- Default value:
null
(same asrightFill
)- Returns:
- the fill of left side of this border
-
getTopStyle
Defines the style of top side of this border.- Default value:
BorderStrokeStyle.NONE
- Returns:
- the style of top side of this border
-
getRightStyle
Defines the style of right side of this border. Ifnull
, thentopStyle
is used;- Default value:
null
(same astopStyle
)- Returns:
- the style of right side of this border
-
getBottomStyle
Defines the style of bottom side of this border. Ifnull
, thentopStyle
is used; UseBorderStyle.NONE
to set the border to have no border style.- Default value:
null
(same astopStyle
)- Returns:
- the style of bottom side of this border
-
getLeftStyle
Defines the style of left side of this border. Ifnull
, thenrightStyle
is used. UseBorderStyle.NONE
to set the border to have no border style.- Default value:
null
(same asrightStyle
)- Returns:
- the style of left side of this border
-
getWidths
Defines the thickness of each side of theBorderStroke
. This will never benull
, and defaults toDEFAULT_WIDTHS
.- Returns:
- the thickness of each side of the
BorderStroke
-
getInsets
Defines the insets of each side of theBorderStroke
. This will never benull
, and defaults toInsets.EMPTY
.- Returns:
- the insets of each side of the
BorderStroke
-
getRadii
Defines the radii for each corner of thisBorderStroke
. This will never benull
, and defaults toCornerRadii.EMPTY
.- Returns:
- the radii for each corner of this
BorderStroke
-
isStrokeUniform
public final boolean isStrokeUniform()Checks if the stroke of this region is uniform. A uniform stroke has all its side strokes (top, bottom, left, right) of same color, width and style.- Returns:
true
if border stroke is uniform
-