public final class Background
extends java.lang.Object
Region
. A Background is an immutable object which
encapsulates the entire set of data required to render the background
of a Region. Because this class is immutable, you can freely reuse the same
Background on many different Regions. Please refer to
JavaFX CSS Reference Guide for a
complete description of the CSS rules for styling the background of a Region.
Every Background is comprised of fills
and / or
images
. Neither list will ever be null, but either or
both may be empty. Each defined BackgroundFill
is rendered in order,
followed by each defined BackgroundImage
.
The Background's outsets
define any extension of the drawing area of a Region
which is necessary to account for all background drawing. These outsets are strictly
defined by the BackgroundFills that are specified on this Background, if any, because
all BackgroundImages are clipped to the drawing area, and do not define it. The
outsets values are strictly non-negative.
Modifier and Type | Field and Description |
---|---|
(package private) static <any> |
BACKGROUND_COLOR |
(package private) static <any> |
BACKGROUND_IMAGE |
(package private) static <any> |
BACKGROUND_INSETS |
(package private) static <any> |
BACKGROUND_POSITION |
(package private) static <any> |
BACKGROUND_RADIUS |
(package private) static <any> |
BACKGROUND_REPEAT |
(package private) static <any> |
BACKGROUND_SIZE |
static Background |
EMPTY
An empty Background, useful to use instead of null.
|
(package private) java.util.List<BackgroundFill> |
fills |
private int |
hash
The cached hash code computation for the Background.
|
private boolean |
hasOpaqueFill
Specifies whether the Background has at least one opaque fill.
|
(package private) boolean |
hasPercentageBasedFills
True if there are any fills that are in some way based on the size of the region.
|
(package private) boolean |
hasPercentageBasedOpaqueFills |
(package private) java.util.List<BackgroundImage> |
images |
private double |
opaqueFillBottom
Package-private immutable fields referring to the opaque insets
of this Background.
|
private double |
opaqueFillLeft
Package-private immutable fields referring to the opaque insets
of this Background.
|
private double |
opaqueFillRight
Package-private immutable fields referring to the opaque insets
of this Background.
|
private double |
opaqueFillTop
Package-private immutable fields referring to the opaque insets
of this Background.
|
(package private) Insets |
outsets |
private static java.util.List<<any>> |
STYLEABLES |
Constructor and Description |
---|
Background(BackgroundFill... fills)
Create a new Background by supplying an array of BackgroundFills.
|
Background(BackgroundFill[] fills,
BackgroundImage[] images)
Create a new Background by supplying two arrays, one for background fills,
and one for background images.
|
Background(BackgroundImage... images)
Create a new Background by supplying an array of BackgroundImages.
|
Background(java.util.List<BackgroundFill> fills,
java.util.List<BackgroundImage> images)
Create a new Background supply two Lists, one for background fills and
one for background images.
|
Modifier and Type | Method and Description |
---|---|
private void |
computeOpaqueInsets(double width,
double height,
boolean firstTime,
double[] trbl)
Computes the opaque insets.
|
(package private) void |
computeOpaqueInsets(double width,
double height,
double[] trbl)
Computes the opaque insets for a region with the specified width and height.
|
boolean |
equals(java.lang.Object o) |
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<BackgroundFill> |
getFills()
The list of BackgroundFills which together define the filled portion
of this Background.
|
java.util.List<BackgroundImage> |
getImages()
The list of BackgroundImages which together define the image portion
of this Background.
|
Insets |
getOutsets()
The outsets of this Background.
|
int |
hashCode() |
boolean |
isEmpty()
Gets whether the background is empty.
|
boolean |
isFillPercentageBased()
Gets whether the fill of this Background is based on percentages (that is, relative to the
size of the region being styled).
|
static final <any> BACKGROUND_COLOR
static final <any> BACKGROUND_RADIUS
static final <any> BACKGROUND_INSETS
static final <any> BACKGROUND_IMAGE
static final <any> BACKGROUND_REPEAT
static final <any> BACKGROUND_POSITION
static final <any> BACKGROUND_SIZE
private static final java.util.List<<any>> STYLEABLES
public static final Background EMPTY
final java.util.List<BackgroundFill> fills
final java.util.List<BackgroundImage> images
final Insets outsets
private final boolean hasOpaqueFill
private final double opaqueFillTop
private final double opaqueFillRight
private final double opaqueFillBottom
private final double opaqueFillLeft
final boolean hasPercentageBasedOpaqueFills
final boolean hasPercentageBasedFills
private final int hash
public Background(BackgroundFill... fills)
fills
or outsets
.fills
- The fills. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of fills. A null array becomes an empty List.public Background(BackgroundImage... images)
images
.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 Background(java.util.List<BackgroundFill> fills, java.util.List<BackgroundImage> images)
fills
, images
, or
outsets
.fills
- The fills. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of fills. A null List becomes an empty List.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 List becomes an empty List.public Background(BackgroundFill[] fills, BackgroundImage[] images)
fills
, images
, or
outsets
.fills
- The fills. This may be null, and may contain nulls. Any
contained nulls are filtered out and not included in the
final List of fills. A null array becomes an empty List.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<BackgroundFill> getFills()
public final java.util.List<BackgroundImage> getImages()
public final Insets getOutsets()
public final boolean isEmpty()
public boolean isFillPercentageBased()
void computeOpaqueInsets(double width, double height, double[] trbl)
width
- The width of the regionheight
- The height of the regiontrbl
- A four-element array of doubles in order: top, right, bottom, left.private void computeOpaqueInsets(double width, double height, boolean firstTime, double[] trbl)
width
- The width of the regionheight
- The height of the regionfirstTime
- Whether this is being called from the constructortrbl
- A four-element array of doubles in order: top, right, bottom, left.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object