Top Description Fields Constructors Methods
javafx.scene.layout

public final Class BorderImage

extends Object
implements Interpolatable<BorderImage>
Class Inheritance
All Implemented Interfaces
javafx.animation.Interpolatable
Imports
com.sun.javafx.scene.layout.region.BorderImageSlices, javafx.animation.Interpolatable, javafx.beans.NamedArg, javafx.geometry.Insets, javafx.scene.image.Image, java.util.Objects

Defines properties describing how to render an image as the border of some Region. A BorderImage must have an Image specified (it cannot be null). The repeatX and repeatY properties define how the image is to be repeated in each direction. The slices property defines how to slice up the image such that it can be stretched across the Region, while the widths defines the area on the Region to fill with the border image. Finally, the outsets define the distance outward from the edge of the border over which the border extends. The outsets of the BorderImage contribute to the outsets of the Border, which in turn contribute to the bounds of the Region.

Because the BorderImage is immutable, it can safely be used in any cache, and can safely be reused among multiple Regions.

When applied to a Region with a defined shape, a BorderImage is ignored.

Since
JavaFX 8.0

Field Summary

Modifier and TypeField and Description
private final boolean
private final int
hash

A cached hash code for faster secondary usage.

private final Image
pack-priv final Insets
private final Insets
pack-priv final Insets
private final BorderRepeat
private final BorderRepeat
private final BorderWidths
private final BorderWidths

Constructor Summary

AccessConstructor and Description
public
BorderImage(Image
The image to use. This must not be null.
image
,
BorderWidths
The widths of the border in each dimension. A null value results in Insets.EMPTY.
widths
,
Insets
The insets at which to place the border relative to the region. A null value results in Insets.EMPTY.
insets
,
BorderWidths
The slices for the image. If null, defaults to BorderImageSlices.DEFAULT
slices
,
boolean
A flag indicating whether the center patch should be drawn
filled
,
BorderRepeat
The repeat value for the border image in the x direction. If null, defaults to STRETCH.
repeatX
,
BorderRepeat
The repeat value for the border image in the y direction. If null, defaults to the same value as repeatX.
repeatY
)

Creates a new BorderImage.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public final Image

Returns:

the image to be used
getImage
()

The image to be used.

public final Insets

Returns:

the insets of the BorderImage
getInsets
()

The insets of the BorderImage define where the border should be positioned relative to the edge of the Region.

public final BorderRepeat

Returns:

the BorderRepeat that indicates if the border image is to be repeated along the x-axis of the region
getRepeatX
()

Indicates in what manner (if at all) the border image is to be repeated along the x-axis of the region.

public final BorderRepeat

Returns:

the BorderRepeat that indicates if the border image is to be repeated along the y-axis of the region
getRepeatY
()

Indicates in what manner (if at all) the border image is to be repeated along the y-axis of the region.

public final BorderWidths

Returns:

the BorderWidths that defines the slices of the image
getSlices
()

Defines the slices of the image.

public final BorderWidths

Returns:

the BorderWidths of the border on each side
getWidths
()

The widths of the border on each side.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public BorderImage
interpolate(BorderImage endValue, double t)

Implements javafx.animation.Interpolatable.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).

public final boolean

Returns:

true if the center patch should be drawn
isFilled
()

Specifies whether or not the center patch (as defined by the left, right, top, and bottom slices) should be drawn.

private boolean
isSame(Image image, BorderWidths widths, BorderWidths slices, boolean filled, BorderRepeat repeatX, BorderRepeat repeatY)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

filledback to summary
private final boolean filled
hashback to summary
private final int hash

A cached hash code for faster secondary usage. It is expected that BorderImage will be pulled from a cache in many cases.

imageback to summary
private final Image image
innerEdgeback to summary
pack-priv final Insets innerEdge
insetsback to summary
private final Insets insets
outerEdgeback to summary
pack-priv final Insets outerEdge
repeatXback to summary
private final BorderRepeat repeatX
repeatYback to summary
private final BorderRepeat repeatY
slicesback to summary
private final BorderWidths slices
widthsback to summary
private final BorderWidths widths

Constructor Detail

BorderImageback to summary
public BorderImage(Image image, BorderWidths widths, Insets insets, BorderWidths slices, boolean filled, BorderRepeat repeatX, BorderRepeat repeatY)

Creates a new BorderImage. The image must be specified or a NullPointerException will be thrown.

Parameters
image:Image

The image to use. This must not be null.

widths:BorderWidths

The widths of the border in each dimension. A null value results in Insets.EMPTY.

insets:Insets

The insets at which to place the border relative to the region. A null value results in Insets.EMPTY.

slices:BorderWidths

The slices for the image. If null, defaults to BorderImageSlices.DEFAULT

filled:boolean

A flag indicating whether the center patch should be drawn

repeatX:BorderRepeat

The repeat value for the border image in the x direction. If null, defaults to STRETCH.

repeatY:BorderRepeat

The repeat value for the border image in the y direction. If null, defaults to the same value as repeatX.

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getImageback to summary
public final Image getImage()

The image to be used. This will never be null. If this image fails to load, then the entire BorderImage will be skipped at rendering time and will not contribute to any bounds or other computations.

Returns:Image

the image to be used

getInsetsback to summary
public final Insets getInsets()

The insets of the BorderImage define where the border should be positioned relative to the edge of the Region. This value will never be null.

Returns:Insets

the insets of the BorderImage

getRepeatXback to summary
public final BorderRepeat getRepeatX()

Indicates in what manner (if at all) the border image is to be repeated along the x-axis of the region. If not specified, the default value is STRETCH.

Returns:BorderRepeat

the BorderRepeat that indicates if the border image is to be repeated along the x-axis of the region

getRepeatYback to summary
public final BorderRepeat getRepeatY()

Indicates in what manner (if at all) the border image is to be repeated along the y-axis of the region. If not specified, the default value is STRETCH.

Returns:BorderRepeat

the BorderRepeat that indicates if the border image is to be repeated along the y-axis of the region

getSlicesback to summary
public final BorderWidths getSlices()

Defines the slices of the image. JavaFX uses a 4-slice scheme where the slices each divide up an image into 9 patches. The top-left patch defines the top-left corner of the border. The top patch defines the top border and the image making up this patch is stretched horizontally (or whatever is defined for repeatX) to fill all the required space. The top-right patch goes in the top-right corner, and the right patch is stretched vertically (or whatever is defined for repeatY) to fill all the required space. And so on. The center patch is stretched (or whatever is defined for repeatX, repeatY) in each dimension. By default the center is omitted (ie: not drawn), although a BorderImageSlices value of true for the filled property will cause the center to be drawn. A default value for this property will result in BorderImageSlices.DEFAULT, which is a border-image-slice of 100%

Returns:BorderWidths

the BorderWidths that defines the slices of the image

See Also
border-image-slice
getWidthsback to summary
public final BorderWidths getWidths()

The widths of the border on each side. These can be defined as either to be absolute widths or percentages of the size of the Region, BorderWidths for more details. If null, this will default to being 1 pixel wide.

Returns:BorderWidths

the BorderWidths of the border on each side

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
interpolateback to summary
public BorderImage interpolate(BorderImage endValue, double t)

Implements javafx.animation.Interpolatable.interpolate.

Doc from javafx.animation.Interpolatable.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).

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.

Annotations
@Override
Exceptions
NullPointerException:
if endValue is null
Since
24
isFilledback to summary
public final boolean isFilled()

Specifies whether or not the center patch (as defined by the left, right, top, and bottom slices) should be drawn.

Returns:boolean

true if the center patch should be drawn

isSameback to summary
private boolean isSame(Image image, BorderWidths widths, BorderWidths slices, boolean filled, BorderRepeat repeatX, BorderRepeat repeatY)