Package javafx.scene.layout
Class BorderStroke
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 BorderImages 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
FieldsModifier and TypeFieldDescriptionstatic final BorderWidthsThe default Insets to be used with a BorderStroke that does not otherwise define any.static final BorderWidthsThe default insets when "medium" is specifiedstatic final BorderWidthsThe default insets when "thick" is specifiedstatic final BorderWidthsThe default insets when "thin" is specified. -
Constructor Summary
ConstructorsConstructorDescriptionBorderStroke(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) Create a new BorderStroke, specifying all construction parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal PaintDefines the fill of bottom side of this border.final BorderStrokeStyleDefines the style of bottom side of this border.final InsetsDefines the insets of each side of the BorderStroke.final PaintDefines the fill of left side of this border.final BorderStrokeStyleDefines the style of left side of this border.final CornerRadiigetRadii()Defines the radii for each corner of this BorderStroke.final PaintDefines the fill of right side of this border.final BorderStrokeStyleDefines the style of right side of this border.final PaintDefines the fill of top side of this border.final BorderStrokeStyleDefines the style of top side of this border.final BorderWidthsDefines the thickness of each side of the BorderStroke.inthashCode()final booleanAn uniform stroke has all (top, bottom, left, right) strokes of same color, width and style
-
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 new BorderStroke.- Parameters:
stroke- The stroke to use for all sides. If null, we default to Color.BLACK.style- The style to use for all sides. If null, we default to BorderStrokeStyle.NONEradii- The radii to use. If null, we default to CornerRadii.EMPTYwidths- The widths to use. If null, we default to DEFAULT_WIDTHS
-
BorderStroke
public BorderStroke(Paint stroke, BorderStrokeStyle style, CornerRadii radii, BorderWidths widths, Insets insets) Creates a new BorderStroke.- Parameters:
stroke- The stroke to use for all sides. If null, we default to Color.BLACK.style- The style to use for all sides. If null, we default to BorderStrokeStyle.NONEradii- The radii to use. If null, we default to CornerRadii.EMPTYwidths- The widths to use. If null, we default to DEFAULT_WIDTHSinsets- The insets indicating where to draw the border relative to the region edges.
-
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) Create a new BorderStroke, specifying all construction parameters.- Parameters:
topStroke- The fill to use on the top. If null, defaults to BLACK.rightStroke- The fill to use on the right. If null, defaults to the same value as topStrokebottomStroke- The fill to use on the bottom. If null, defaults to the same value as bottomStrokeleftStroke- The fill to use on the left. If null, defaults to the same value as rightStroketopStyle- The style to use on the top. If null, defaults to BorderStrokeStyle.NONErightStyle- The style to use on the right. If null, defaults to the same value as topStylebottomStyle- The style to use on the bottom. If null, defaults to the same value as topStyleleftStyle- The style to use on the left. If null, defaults to the same value as rightStyleradii- The radii. If null, we default to square corners by using CornerRadii.EMPTYwidths- The thickness of each side. If null, we default to DEFAULT_WIDTHS.insets- The insets indicating where to draw the border relative to the region edges.
-
-
Method Details
-
getTopStroke
Defines the fill of top side of this border.- Default value:
- black
-
getRightStroke
Defines the fill of right side of this border. Ifnullthen the topFill is used.- Default value:
- null = same as topFill
-
getBottomStroke
Defines the fill of bottom side of this border. Ifnullthen the topFill is used.- Default value:
- null = same as topFill
-
getLeftStroke
Defines the fill of left side of this border. Ifnullthen the rightFill is used.- Default value:
- null = same sa rightFill
-
getTopStyle
Defines the style of top side of this border.- Default value:
- none
-
getRightStyle
Defines the style of right side of this border. Ifnullthen topStyle is used;- Default value:
- null = same as topStyle
-
getBottomStyle
Defines the style of bottom side of this border. Ifnullthen topStyle is used; Use BorderStyle.NONE to set the border to have no border style.- Default value:
- null = same as topStyle
-
getLeftStyle
Defines the style of left side of this border. Ifnullthen rightStyle is used. Use BorderStyle.NONE to set the border to have no border style.- Default value:
- null = same as rightStyle
-
getWidths
Defines the thickness of each side of the BorderStroke. This will never be null, and defaults to DEFAULT_WIDTHS. -
getInsets
Defines the insets of each side of the BorderStroke. This will never be null, and defaults to EMPTY. -
getRadii
Defines the radii for each corner of this BorderStroke. This will never be null, and defaults to CornerRadii.EMPTY. -
isStrokeUniform
public final boolean isStrokeUniform()An uniform stroke has all (top, bottom, left, right) strokes of same color, width and style- Returns:
- true if border stroke is uniform as defined above
-
equals
-
hashCode
public int hashCode()
-