Class BackgroundFill
java.lang.Object
javafx.scene.layout.BackgroundFill
- All Implemented Interfaces:
Interpolatable<BackgroundFill>
public final class BackgroundFill extends Object implements Interpolatable<BackgroundFill>
The fill and associated properties that direct how to fill the background of a
Region. Because BackgroundFill is an immutable object, it can safely be used in any cache, and can safely be reused among multiple Regions or multiple times in the same Region. All BackgroundFills are drawn in order.
When applied to a Region with a defined shape, the corner radii are ignored.
- Since:
- JavaFX 8.0
Constructor Summary
| Constructor | Description |
|---|---|
BackgroundFill |
Creates a new BackgroundFill with the specified fill, radii, and insets. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
final Paint |
getFill() |
The Paint to use for filling the background of the Region. |
final Insets |
getInsets() |
The Insets to use for this fill. |
final CornerRadii |
getRadii() |
The Radii to use for representing the four radii of the BackgroundFill. |
BackgroundFill |
interpolate |
Returns an intermediate value between the value of this Interpolatable and the specified endValue using the linear interpolation factor t, ranging from 0 (inclusive) to 1 (inclusive). |
Constructor Details
BackgroundFill
public BackgroundFill(Paint fill, CornerRadii radii, Insets insets)
Creates a new BackgroundFill with the specified fill, radii, and insets. Null values are acceptable, but default values will be used in place of any null value.
- Parameters:
-
fill- Any Paint. If null, the value Color.TRANSPARENT is used. -
radii- The corner Radii. If null, the value Radii.EMPTY is used. -
insets- The insets. If null, the value Insets.EMPTY is used.
Method Details
getFill
getRadii
public final CornerRadii getRadii()
The Radii to use for representing the four radii of the BackgroundFill. Each corner can therefore be independently specified. This will never be null. The radii values will never be negative.
- Interpolation Type:
- default
- Returns:
- the Radii to use for representing the four radii of the BackgroundFill
getInsets
public final Insets getInsets()
The Insets to use for this fill. Each inset indicates at what distance from the Region's bounds the drawing should begin. The insets will never be null, but the values may be negative in order to position the border beyond the natural bounds (that is, (0, 0, width, height)) of the Region.
- Interpolation Type:
- default
- Returns:
- the Insets to use for this fill
interpolate
public BackgroundFill interpolate(BackgroundFill endValue, double t)
Returns an intermediate value between the value of this
Interpolatable and the specified endValue using the linear interpolation factor t, ranging from 0 (inclusive) to 1 (inclusive). The returned value might not be a new instance; the implementation might also return one of the two existing instances if the intermediate value would be equal to one of the existing values. However, this is an optimization and applications should not assume any particular identity of the returned value.
- Specified by:
-
interpolatein interfaceInterpolatable<BackgroundFill> - Parameters:
-
endValue- the target value -
t- the interpolation factor - Returns:
- the intermediate value
- Throws:
-
NullPointerException- ifendValueisnull - Since:
- 24
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.