public final class Border
extends java.lang.Object
Region
. A Border is an immutable object which
encapsulates the entire set of data required to render the border
of a Region. Because this class is immutable, you can freely reuse the same
Border on many different Regions. Please refer to
JavaFX CSS Reference Guide for a
complete description of the CSS rules for styling the border of a Region.
Every Border is comprised of strokes
and / or
images
. Neither list will ever be null, but either or
both may be empty. When rendering, if no images are specified or no
image succeeds in loading, then all strokes will be rendered in order.
If any image is specified and succeeds in loading, then no strokes will
be drawn, although they will still contribute to the insets
and outsets
of the Border.
The Border's outsets
define any extension of the drawing area of a Region
which is necessary to account for all border drawing and positioning. These outsets are defined
by both the BorderStroke
s and BorderImage
s specified on this Border.
Outsets are strictly non-negative.
getInsets()
are used to define the inner-most edge of all of the borders. It also is
always strictly non-negative. The Region uses the insets of the Background
and Border
and the Region's padding
to determine the
Region insets
, which define the content area
for any children of the Region. The outsets of a Border together with the outsets of a Background
and the width and height of the Region define the geometric bounds of the Region (which in
turn contribute to the layoutBounds
, boundsInLocal
, and boundsInParent
).
A Border is most often used in cases where you want to skin the Region with an image, often used in conjunction with 9-patch scaling techniques. In such cases, you may also specify a stroked border which is only used when the image fails to load for some reason.
Modifier and Type | Field and Description |
---|---|
(package private) static <any> |
BORDER_COLOR |
(package private) static <any> |
BORDER_IMAGE_INSETS |
(package private) static <any> |
BORDER_IMAGE_REPEAT |
(package private) static <any> |
BORDER_IMAGE_SLICE |
(package private) static <any> |
BORDER_IMAGE_SOURCE |
(package private) static <any> |
BORDER_IMAGE_WIDTH |
(package private) static <any> |
BORDER_INSETS |
(package private) static <any> |
BORDER_RADIUS |
(package private) static <any> |
BORDER_STYLE |
(package private) static <any> |
BORDER_WIDTH |
static Border |
EMPTY
An empty Border, useful to use instead of null.
|
private int |
hash
The cached hash code computation for the Border.
|
(package private) java.util.List<BorderImage> |
images |
(package private) Insets |
insets |
(package private) Insets |
outsets |
(package private) java.util.List<BorderStroke> |
strokes |
private static java.util.List<<any>> |
STYLEABLES |
Constructor and Description |
---|
Border(BorderImage... images)
Creates a new Border by supplying an array of BorderImages.
|
Border(BorderStroke... strokes)
Creates a new Border by supplying an array of BorderStrokes.
|
Border(BorderStroke[] strokes,
BorderImage[] images)
Creates a new Border by supplying an array of BorderStrokes and BorderImages.
|
Border(java.util.List<BorderStroke> strokes,
java.util.List<BorderImage> images)
Creates a new Border by supplying a List of BorderStrokes and BorderImages.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<BorderImage> |
getImages()
The list of BorderImages which together define the images to use
instead of stroke for this Border.
|
Insets |
getInsets()
The insets define the distance from the edge of the Region to the inner-most edge
of the border, if that distance is non-negative.
|
Insets |
getOutsets()
The outsets of the border define the outer-most edge of the border to be drawn.
|
java.util.List<BorderStroke> |
getStrokes()
The list of BorderStrokes which together define the stroked portion
of this Border.
|
int |
hashCode() |
boolean |
isEmpty()
Gets whether the Border is empty.
|
static final <any> BORDER_COLOR
static final <any> BORDER_STYLE
static final <any> BORDER_WIDTH
static final <any> BORDER_RADIUS
static final <any> BORDER_INSETS
static final <any> BORDER_IMAGE_SOURCE
static final <any> BORDER_IMAGE_REPEAT
static final <any> BORDER_IMAGE_SLICE
static final <any> BORDER_IMAGE_WIDTH
static final <any> BORDER_IMAGE_INSETS
private static final java.util.List<<any>> STYLEABLES
public static final Border EMPTY
final java.util.List<BorderStroke> strokes
final java.util.List<BorderImage> images
final Insets outsets
final Insets insets
private final int hash
public Border(BorderStroke... strokes)
strokes
or outsets
or insets
.strokes
- The strokes. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of strokes. A null array becomes an empty List.
If both strokes and images are specified, and if any one
of the images specified succeeds in loading, then no
strokes are shown. In this way, strokes can be defined as
a fallback in the case that an image failed to load.public Border(BorderImage... images)
images
or outsets
or insets
.images
- The images. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of images. A null array becomes an empty List.public Border(java.util.List<BorderStroke> strokes, java.util.List<BorderImage> images)
strokes
or images
, outsets
, or
insets
.strokes
- The strokes. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of strokes. A null array becomes an empty List.
If both strokes and images are specified, and if any one
of the images specified succeeds in loading, then no
strokes are shown. In this way, strokes can be defined as
a fallback in the case that an image failed to load.images
- The images. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of images. A null array becomes an empty List.public Border(BorderStroke[] strokes, BorderImage[] images)
strokes
or images
, outsets
, or
insets
.strokes
- The strokes. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of strokes. A null array becomes an empty List.
If both strokes and images are specified, and if any one
of the images specified succeeds in loading, then no
strokes are shown. In this way, strokes can be defined as
a fallback in the case that an image failed to load.images
- The images. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of images. A null array becomes an empty List.public static java.util.List<<any>> getClassCssMetaData()
public final java.util.List<BorderStroke> getStrokes()
public final java.util.List<BorderImage> getImages()
strokes
are not drawn. If this list is null or no images
succeeded in loading, then any specified strokes
are drawn.
This List is unmodifiable and immutable. It will never be null. It will never contain any null elements.
public final Insets getOutsets()
public final Insets getInsets()
public final boolean isEmpty()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object