Top Description Fields Constructors Methods
javafx.scene.layout

public final Class CornerRadii

extends Object
implements Interpolatable<CornerRadii>
Class Inheritance
All Implemented Interfaces
javafx.animation.Interpolatable
Imports
com.sun.javafx.util.InterpolationUtils, javafx.animation.Interpolatable, javafx.beans.NamedArg, java.util.Objects

Defines the radii of each of the four corners of a BorderStroke. The CornerRadii class is immutable and therefore can be reused on multiple BorderStrokes. This class defines 8 different values, corresponding to the horizontal and vertical components of 4 quarter ellipses, which in turn define the curvature of the corners of the BorderStroke.
Since
JavaFX 8.0

Field Summary

Modifier and TypeField and Description
private final double
private final boolean
private final double
private final boolean
private final double
private final boolean
private final double
private final boolean
public static final CornerRadii
EMPTY

A CornerRadii which is entirely empty, indicating squared corners.

private final int
hash

The cached hash code.

pack-priv final boolean
private final double
private final boolean
private final double
private final boolean
private final double
private final boolean
private final double
private final boolean
private final boolean

Constructor Summary

AccessConstructor and Description
public
CornerRadii(double
The radii for each corner. Negative values are not allowed.
radius
)

Create a new CornerRadii with a single uniform radii value for all components of all corners.

public
CornerRadii(double
The radii for each corner. Negative values are not allowed.
radius
,
boolean
Whether the radii should be interpreted as a percentage.
asPercent
)

Create a new CornerRadii with the given radii for each corner.

public
CornerRadii(double
The radii of the top-left corner. Negative numbers are not allowed.
topLeft
,
double
The radii of the top-right corner. Negative numbers are not allowed.
topRight
,
double
The radii of the bottom-right corner. Negative numbers are not allowed.
bottomRight
,
double
The radii of the bottom-left corner. Negative numbers are not allowed.
bottomLeft
,
boolean
Whether all four radii should be considered as values or percentages
asPercent
)

Create a new CornerRadii with uniform yet independent radii for each corner.

public
CornerRadii(double
The length of the horizontal radii of the top-left corner
topLeftHorizontalRadius
,
double
The length of the vertical radii of the top-left corner
topLeftVerticalRadius
,
double
The length of the vertical radii of the top-right corner
topRightVerticalRadius
,
double
The length of the horizontal radii of the top-right corner
topRightHorizontalRadius
,
double
The length of the horizontal radii of the bottom-right corner
bottomRightHorizontalRadius
,
double
The length of the vertical radii of the bottom-right corner
bottomRightVerticalRadius
,
double
The length of the vertical radii of the bottom-left corner
bottomLeftVerticalRadius
,
double
The length of the horizontal radii of the bottom-left corner
bottomLeftHorizontalRadius
,
boolean
Is the horizontal radii of the top-left corner as percentage
topLeftHorizontalRadiusAsPercent
,
boolean
Is the vertical radii of the top-left corner as percentage
topLeftVerticalRadiusAsPercent
,
boolean
Is the vertical radii of the top-right corner as percentage
topRightVerticalRadiusAsPercent
,
boolean
Is the horizontal radii of the top-right corner as percentage
topRightHorizontalRadiusAsPercent
,
boolean
Is the horizontal radii of the bottom-right corner as percentage
bottomRightHorizontalRadiusAsPercent
,
boolean
Is the vertical radii of the bottom-right corner as percentage
bottomRightVerticalRadiusAsPercent
,
boolean
Is the vertical radii of the bottom-left corner as percentage
bottomLeftVerticalRadiusAsPercent
,
boolean
Is the horizontal radii of the bottom-left corner as percentage
bottomLeftHorizontalRadiusAsPercent
)

Creates a new CornerRadii, allowing for specification of each component of each corner radii and whether each component should be treated as a value or percentage.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

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

public final double

Returns:

the length of the horizontal radii of the bottom-left corner
getBottomLeftHorizontalRadius
()

The length of the horizontal radii of the bottom-left corner.

public final double

Returns:

the length of the vertical radii of the bottom-left corner
getBottomLeftVerticalRadius
()

The length of the vertical radii of the bottom-left corner.

public final double

Returns:

the length of the horizontal radii of the bottom-right corner
getBottomRightHorizontalRadius
()

The length of the horizontal radii of the bottom-right corner.

public final double

Returns:

the length of the vertical radii of the bottom-right corner
getBottomRightVerticalRadius
()

The length of the vertical radii of the bottom-right corner.

public final double

Returns:

the length of the horizontal radii of the top-left corner
getTopLeftHorizontalRadius
()

The length of the horizontal radii of the top-left corner.

public final double

Returns:

the length of the vertical radii of the top-left corner
getTopLeftVerticalRadius
()

The length of the vertical radii of the top-left corner.

public final double

Returns:

the length of the horizontal radii of the top-right corner
getTopRightHorizontalRadius
()

The length of the horizontal radii of the top-right corner.

public final double

Returns:

the length of the vertical radii of the top-right corner
getTopRightVerticalRadius
()

The length of the vertical radii of the top-right corner.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public CornerRadii
interpolate(CornerRadii
the target value
endValue
,
double
the interpolation factor
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).

private static double
interpolate(double start, double end, boolean startIsPercentage, boolean endIsPercentage, double t)

public final boolean

Returns:

if true bottomLeftHorizontalRadius is in percentage, otherwise a value
isBottomLeftHorizontalRadiusAsPercentage
()

Indicates whether bottomLeftHorizontalRadius is interpreted as a value or a percentage.

public final boolean

Returns:

if true bottomLeftVerticalRadius is in percentage, otherwise a value
isBottomLeftVerticalRadiusAsPercentage
()

Indicates whether bottomLeftVerticalRadius is interpreted as a value or a percentage.

public final boolean

Returns:

if true bottomRightHorizontalRadius is in percentage, otherwise a value
isBottomRightHorizontalRadiusAsPercentage
()

Indicates whether bottomRightHorizontalRadius is interpreted as a value or a percentage.

public final boolean

Returns:

if true bottomRightVerticalRadius is in percentage, otherwise a value
isBottomRightVerticalRadiusAsPercentage
()

Indicates whether bottomRightVerticalRadius is interpreted as a value or a percentage.

private boolean
isSame(double topLeftHorizontalRadius, double topLeftVerticalRadius, double topRightVerticalRadius, double topRightHorizontalRadius, double bottomRightHorizontalRadius, double bottomRightVerticalRadius, double bottomLeftVerticalRadius, double bottomLeftHorizontalRadius, boolean topLeftHorizontalRadiusAsPercentage, boolean topLeftVerticalRadiusAsPercentage, boolean topRightVerticalRadiusAsPercentage, boolean topRightHorizontalRadiusAsPercentage, boolean bottomRightHorizontalRadiusAsPercentage, boolean bottomRightVerticalRadiusAsPercentage, boolean bottomLeftVerticalRadiusAsPercentage, boolean bottomLeftHorizontalRadiusAsPercentage)

public final boolean

Returns:

if true topLeftHorizontalRadius is in percentage, otherwise a value
isTopLeftHorizontalRadiusAsPercentage
()

Indicates whether topLeftHorizontalRadius is interpreted as a value or a percentage.

public final boolean

Returns:

if true topLeftVerticalRadius is in percentage, otherwise a value
isTopLeftVerticalRadiusAsPercentage
()

Indicates whether topLeftVerticalRadius is interpreted as a value or a percentage.

public final boolean

Returns:

if true topRightHorizontalRadius is in percentage, otherwise a value
isTopRightHorizontalRadiusAsPercentage
()

Indicates whether topRightHorizontalRadius is interpreted as a value or a percentage.

public final boolean

Returns:

if true topRightVerticalRadius is in percentage, otherwise a value
isTopRightVerticalRadiusAsPercentage
()

Indicates whether topRightVerticalRadius is interpreted as a value or a percentage.

public final boolean

Returns:

if true each corner radius is uniformly percentage-based, otherwise not
isUniform
()

Indicates whether each corner radius is exactly the same, and each are either uniformly percentage-based or not.

private int
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

bottomLeftHorizontalRadiusback to summary
private final double bottomLeftHorizontalRadius
bottomLeftHorizontalRadiusAsPercentageback to summary
private final boolean bottomLeftHorizontalRadiusAsPercentage
bottomLeftVerticalRadiusback to summary
private final double bottomLeftVerticalRadius
bottomLeftVerticalRadiusAsPercentageback to summary
private final boolean bottomLeftVerticalRadiusAsPercentage
bottomRightHorizontalRadiusback to summary
private final double bottomRightHorizontalRadius
bottomRightHorizontalRadiusAsPercentageback to summary
private final boolean bottomRightHorizontalRadiusAsPercentage
bottomRightVerticalRadiusback to summary
private final double bottomRightVerticalRadius
bottomRightVerticalRadiusAsPercentageback to summary
private final boolean bottomRightVerticalRadiusAsPercentage
EMPTYback to summary
public static final CornerRadii EMPTY

A CornerRadii which is entirely empty, indicating squared corners. This is the default value for a BorderStroke's radii.

hashback to summary
private final int hash

The cached hash code.

hasPercentBasedRadiiback to summary
pack-priv final boolean hasPercentBasedRadii
topLeftHorizontalRadiusback to summary
private final double topLeftHorizontalRadius
topLeftHorizontalRadiusAsPercentageback to summary
private final boolean topLeftHorizontalRadiusAsPercentage
topLeftVerticalRadiusback to summary
private final double topLeftVerticalRadius
topLeftVerticalRadiusAsPercentageback to summary
private final boolean topLeftVerticalRadiusAsPercentage
topRightHorizontalRadiusback to summary
private final double topRightHorizontalRadius
topRightHorizontalRadiusAsPercentageback to summary
private final boolean topRightHorizontalRadiusAsPercentage
topRightVerticalRadiusback to summary
private final double topRightVerticalRadius
topRightVerticalRadiusAsPercentageback to summary
private final boolean topRightVerticalRadiusAsPercentage
uniformback to summary
private final boolean uniform

Constructor Detail

CornerRadiiback to summary
public CornerRadii(double radius)

Create a new CornerRadii with a single uniform radii value for all components of all corners. This constructor will create the CornerRadii such that none of the values are percentages.

Parameters
radius:double

The radii for each corner. Negative values are not allowed.

CornerRadiiback to summary
public CornerRadii(double radius, boolean asPercent)

Create a new CornerRadii with the given radii for each corner. The value is interpreted either as being a percentage or not based on the asPercent argument.

Parameters
radius:double

The radii for each corner. Negative values are not allowed.

asPercent:boolean

Whether the radii should be interpreted as a percentage.

CornerRadiiback to summary
public CornerRadii(double topLeft, double topRight, double bottomRight, double bottomLeft, boolean asPercent)

Create a new CornerRadii with uniform yet independent radii for each corner. That is, each corner can be specified independently, but the horizontal and vertical components of each corner is uniform.

Parameters
topLeft:double

The radii of the top-left corner. Negative numbers are not allowed.

topRight:double

The radii of the top-right corner. Negative numbers are not allowed.

bottomRight:double

The radii of the bottom-right corner. Negative numbers are not allowed.

bottomLeft:double

The radii of the bottom-left corner. Negative numbers are not allowed.

asPercent:boolean

Whether all four radii should be considered as values or percentages

CornerRadiiback to summary
public CornerRadii(double topLeftHorizontalRadius, double topLeftVerticalRadius, double topRightVerticalRadius, double topRightHorizontalRadius, double bottomRightHorizontalRadius, double bottomRightVerticalRadius, double bottomLeftVerticalRadius, double bottomLeftHorizontalRadius, boolean topLeftHorizontalRadiusAsPercent, boolean topLeftVerticalRadiusAsPercent, boolean topRightVerticalRadiusAsPercent, boolean topRightHorizontalRadiusAsPercent, boolean bottomRightHorizontalRadiusAsPercent, boolean bottomRightVerticalRadiusAsPercent, boolean bottomLeftVerticalRadiusAsPercent, boolean bottomLeftHorizontalRadiusAsPercent)

Creates a new CornerRadii, allowing for specification of each component of each corner radii and whether each component should be treated as a value or percentage.

Parameters
topLeftHorizontalRadius:double

The length of the horizontal radii of the top-left corner

topLeftVerticalRadius:double

The length of the vertical radii of the top-left corner

topRightVerticalRadius:double

The length of the vertical radii of the top-right corner

topRightHorizontalRadius:double

The length of the horizontal radii of the top-right corner

bottomRightHorizontalRadius:double

The length of the horizontal radii of the bottom-right corner

bottomRightVerticalRadius:double

The length of the vertical radii of the bottom-right corner

bottomLeftVerticalRadius:double

The length of the vertical radii of the bottom-left corner

bottomLeftHorizontalRadius:double

The length of the horizontal radii of the bottom-left corner

topLeftHorizontalRadiusAsPercent:boolean

Is the horizontal radii of the top-left corner as percentage

topLeftVerticalRadiusAsPercent:boolean

Is the vertical radii of the top-left corner as percentage

topRightVerticalRadiusAsPercent:boolean

Is the vertical radii of the top-right corner as percentage

topRightHorizontalRadiusAsPercent:boolean

Is the horizontal radii of the top-right corner as percentage

bottomRightHorizontalRadiusAsPercent:boolean

Is the horizontal radii of the bottom-right corner as percentage

bottomRightVerticalRadiusAsPercent:boolean

Is the vertical radii of the bottom-right corner as percentage

bottomLeftVerticalRadiusAsPercent:boolean

Is the vertical radii of the bottom-left corner as percentage

bottomLeftHorizontalRadiusAsPercent:boolean

Is the horizontal radii of the bottom-left corner as percentage

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.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getBottomLeftHorizontalRadiusback to summary
public final double getBottomLeftHorizontalRadius()

The length of the horizontal radii of the bottom-left corner.

Returns:double

the length of the horizontal radii of the bottom-left corner

getBottomLeftVerticalRadiusback to summary
public final double getBottomLeftVerticalRadius()

The length of the vertical radii of the bottom-left corner.

Returns:double

the length of the vertical radii of the bottom-left corner

getBottomRightHorizontalRadiusback to summary
public final double getBottomRightHorizontalRadius()

The length of the horizontal radii of the bottom-right corner.

Returns:double

the length of the horizontal radii of the bottom-right corner

getBottomRightVerticalRadiusback to summary
public final double getBottomRightVerticalRadius()

The length of the vertical radii of the bottom-right corner.

Returns:double

the length of the vertical radii of the bottom-right corner

getTopLeftHorizontalRadiusback to summary
public final double getTopLeftHorizontalRadius()

The length of the horizontal radii of the top-left corner.

Returns:double

the length of the horizontal radii of the top-left corner

getTopLeftVerticalRadiusback to summary
public final double getTopLeftVerticalRadius()

The length of the vertical radii of the top-left corner.

Returns:double

the length of the vertical radii of the top-left corner

getTopRightHorizontalRadiusback to summary
public final double getTopRightHorizontalRadius()

The length of the horizontal radii of the top-right corner.

Returns:double

the length of the horizontal radii of the top-right corner

getTopRightVerticalRadiusback to summary
public final double getTopRightVerticalRadius()

The length of the vertical radii of the top-right corner.

Returns:double

the length of the vertical radii of the top-right corner

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.
Returns:int

a hash code value for this object

Annotations
@Override
interpolateback to summary
public CornerRadii interpolate(CornerRadii 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.

Parameters
endValue:CornerRadii

the target value

t:double

the interpolation factor

Returns:CornerRadii

the intermediate value

Annotations
@Override
Exceptions
NullPointerException:
if endValue is null
Since
24
interpolateback to summary
private static double interpolate(double start, double end, boolean startIsPercentage, boolean endIsPercentage, double t)
isBottomLeftHorizontalRadiusAsPercentageback to summary
public final boolean isBottomLeftHorizontalRadiusAsPercentage()

Indicates whether bottomLeftHorizontalRadius is interpreted as a value or a percentage.

Returns:boolean

if true bottomLeftHorizontalRadius is in percentage, otherwise a value

isBottomLeftVerticalRadiusAsPercentageback to summary
public final boolean isBottomLeftVerticalRadiusAsPercentage()

Indicates whether bottomLeftVerticalRadius is interpreted as a value or a percentage.

Returns:boolean

if true bottomLeftVerticalRadius is in percentage, otherwise a value

isBottomRightHorizontalRadiusAsPercentageback to summary
public final boolean isBottomRightHorizontalRadiusAsPercentage()

Indicates whether bottomRightHorizontalRadius is interpreted as a value or a percentage.

Returns:boolean

if true bottomRightHorizontalRadius is in percentage, otherwise a value

isBottomRightVerticalRadiusAsPercentageback to summary
public final boolean isBottomRightVerticalRadiusAsPercentage()

Indicates whether bottomRightVerticalRadius is interpreted as a value or a percentage.

Returns:boolean

if true bottomRightVerticalRadius is in percentage, otherwise a value

isSameback to summary
private boolean isSame(double topLeftHorizontalRadius, double topLeftVerticalRadius, double topRightVerticalRadius, double topRightHorizontalRadius, double bottomRightHorizontalRadius, double bottomRightVerticalRadius, double bottomLeftVerticalRadius, double bottomLeftHorizontalRadius, boolean topLeftHorizontalRadiusAsPercentage, boolean topLeftVerticalRadiusAsPercentage, boolean topRightVerticalRadiusAsPercentage, boolean topRightHorizontalRadiusAsPercentage, boolean bottomRightHorizontalRadiusAsPercentage, boolean bottomRightVerticalRadiusAsPercentage, boolean bottomLeftVerticalRadiusAsPercentage, boolean bottomLeftHorizontalRadiusAsPercentage)
isTopLeftHorizontalRadiusAsPercentageback to summary
public final boolean isTopLeftHorizontalRadiusAsPercentage()

Indicates whether topLeftHorizontalRadius is interpreted as a value or a percentage.

Returns:boolean

if true topLeftHorizontalRadius is in percentage, otherwise a value

isTopLeftVerticalRadiusAsPercentageback to summary
public final boolean isTopLeftVerticalRadiusAsPercentage()

Indicates whether topLeftVerticalRadius is interpreted as a value or a percentage.

Returns:boolean

if true topLeftVerticalRadius is in percentage, otherwise a value

isTopRightHorizontalRadiusAsPercentageback to summary
public final boolean isTopRightHorizontalRadiusAsPercentage()

Indicates whether topRightHorizontalRadius is interpreted as a value or a percentage.

Returns:boolean

if true topRightHorizontalRadius is in percentage, otherwise a value

isTopRightVerticalRadiusAsPercentageback to summary
public final boolean isTopRightVerticalRadiusAsPercentage()

Indicates whether topRightVerticalRadius is interpreted as a value or a percentage.

Returns:boolean

if true topRightVerticalRadius is in percentage, otherwise a value

isUniformback to summary
public final boolean isUniform()

Indicates whether each corner radius is exactly the same, and each are either uniformly percentage-based or not.

Returns:boolean

if true each corner radius is uniformly percentage-based, otherwise not

preComputeHashback to summary
private int preComputeHash()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override