Class CornerRadii
java.lang.Object
javafx.scene.layout.CornerRadii
- All Implemented Interfaces:
- Interpolatable<CornerRadii>
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 SummaryFieldsModifier and TypeFieldDescriptionstatic final CornerRadiiA CornerRadii which is entirely empty, indicating squared corners.
- 
Constructor SummaryConstructorsConstructorDescriptionCornerRadii(double radius) Create a new CornerRadii with a single uniform radii value for all components of all corners.CornerRadii(double radius, boolean asPercent) Create a new CornerRadii with the given radii for each corner.CornerRadii(double topLeft, double topRight, double bottomRight, double bottomLeft, boolean asPercent) Create a new CornerRadii with uniform yet independent radii for each corner.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.
- 
Method SummaryModifier and TypeMethodDescriptionfinal doubleThe length of the horizontal radii of the bottom-left corner.final doubleThe length of the vertical radii of the bottom-left corner.final doubleThe length of the horizontal radii of the bottom-right corner.final doubleThe length of the vertical radii of the bottom-right corner.final doubleThe length of the horizontal radii of the top-left corner.final doubleThe length of the vertical radii of the top-left corner.final doubleThe length of the horizontal radii of the top-right corner.final doubleThe length of the vertical radii of the top-right corner.interpolate(CornerRadii endValue, double t) Returns an intermediate value between the value of thisInterpolatableand the specifiedendValueusing the linear interpolation factort, ranging from 0 (inclusive) to 1 (inclusive).final booleanIndicates whetherbottomLeftHorizontalRadiusis interpreted as a value or a percentage.final booleanIndicates whetherbottomLeftVerticalRadiusis interpreted as a value or a percentage.final booleanIndicates whetherbottomRightHorizontalRadiusis interpreted as a value or a percentage.final booleanIndicates whetherbottomRightVerticalRadiusis interpreted as a value or a percentage.final booleanIndicates whethertopLeftHorizontalRadiusis interpreted as a value or a percentage.final booleanIndicates whethertopLeftVerticalRadiusis interpreted as a value or a percentage.final booleanIndicates whethertopRightHorizontalRadiusis interpreted as a value or a percentage.final booleanIndicates whethertopRightVerticalRadiusis interpreted as a value or a percentage.final booleanIndicates whether each corner radius is exactly the same, and each are either uniformly percentage-based or not.
- 
Field Details- 
EMPTYA CornerRadii which is entirely empty, indicating squared corners. This is the default value for a BorderStroke's radii.
 
- 
- 
Constructor Details- 
CornerRadiipublic 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- The radii for each corner. Negative values are not allowed.
 
- 
CornerRadiipublic 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 theasPercentargument.- Parameters:
- radius- The radii for each corner. Negative values are not allowed.
- asPercent- Whether the radii should be interpreted as a percentage.
 
- 
CornerRadiipublic 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- The radii of the top-left corner. Negative numbers are not allowed.
- topRight- The radii of the top-right corner. Negative numbers are not allowed.
- bottomRight- The radii of the bottom-right corner. Negative numbers are not allowed.
- bottomLeft- The radii of the bottom-left corner. Negative numbers are not allowed.
- asPercent- Whether all four radii should be considered as values or percentages
 
- 
CornerRadiipublic 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- The length of the horizontal radii of the top-left corner
- topLeftVerticalRadius- The length of the vertical radii of the top-left corner
- topRightVerticalRadius- The length of the vertical radii of the top-right corner
- topRightHorizontalRadius- The length of the horizontal radii of the top-right corner
- bottomRightHorizontalRadius- The length of the horizontal radii of the bottom-right corner
- bottomRightVerticalRadius- The length of the vertical radii of the bottom-right corner
- bottomLeftVerticalRadius- The length of the vertical radii of the bottom-left corner
- bottomLeftHorizontalRadius- The length of the horizontal radii of the bottom-left corner
- topLeftHorizontalRadiusAsPercent- Is the horizontal radii of the top-left corner as percentage
- topLeftVerticalRadiusAsPercent- Is the vertical radii of the top-left corner as percentage
- topRightVerticalRadiusAsPercent- Is the vertical radii of the top-right corner as percentage
- topRightHorizontalRadiusAsPercent- Is the horizontal radii of the top-right corner as percentage
- bottomRightHorizontalRadiusAsPercent- Is the horizontal radii of the bottom-right corner as percentage
- bottomRightVerticalRadiusAsPercent- Is the vertical radii of the bottom-right corner as percentage
- bottomLeftVerticalRadiusAsPercent- Is the vertical radii of the bottom-left corner as percentage
- bottomLeftHorizontalRadiusAsPercent- Is the horizontal radii of the bottom-left corner as percentage
 
 
- 
- 
Method Details- 
getTopLeftHorizontalRadiuspublic final double getTopLeftHorizontalRadius()The length of the horizontal radii of the top-left corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the horizontal radii of the top-left corner
 
- 
getTopLeftVerticalRadiuspublic final double getTopLeftVerticalRadius()The length of the vertical radii of the top-left corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the vertical radii of the top-left corner
 
- 
getTopRightVerticalRadiuspublic final double getTopRightVerticalRadius()The length of the vertical radii of the top-right corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the vertical radii of the top-right corner
 
- 
getTopRightHorizontalRadiuspublic final double getTopRightHorizontalRadius()The length of the horizontal radii of the top-right corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the horizontal radii of the top-right corner
 
- 
getBottomRightHorizontalRadiuspublic final double getBottomRightHorizontalRadius()The length of the horizontal radii of the bottom-right corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the horizontal radii of the bottom-right corner
 
- 
getBottomRightVerticalRadiuspublic final double getBottomRightVerticalRadius()The length of the vertical radii of the bottom-right corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the vertical radii of the bottom-right corner
 
- 
getBottomLeftVerticalRadiuspublic final double getBottomLeftVerticalRadius()The length of the vertical radii of the bottom-left corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the vertical radii of the bottom-left corner
 
- 
getBottomLeftHorizontalRadiuspublic final double getBottomLeftHorizontalRadius()The length of the horizontal radii of the bottom-left corner.- Interpolation Type:
- linear if both values are
                    absolute or both values are percentages, discrete otherwise
- Returns:
- the length of the horizontal radii of the bottom-left corner
 
- 
isTopLeftHorizontalRadiusAsPercentagepublic final boolean isTopLeftHorizontalRadiusAsPercentage()Indicates whethertopLeftHorizontalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true topLeftHorizontalRadius is in percentage, otherwise a value
 
- 
isTopLeftVerticalRadiusAsPercentagepublic final boolean isTopLeftVerticalRadiusAsPercentage()Indicates whethertopLeftVerticalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true topLeftVerticalRadius is in percentage, otherwise a value
 
- 
isTopRightVerticalRadiusAsPercentagepublic final boolean isTopRightVerticalRadiusAsPercentage()Indicates whethertopRightVerticalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true topRightVerticalRadius is in percentage, otherwise a value
 
- 
isTopRightHorizontalRadiusAsPercentagepublic final boolean isTopRightHorizontalRadiusAsPercentage()Indicates whethertopRightHorizontalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true topRightHorizontalRadius is in percentage, otherwise a value
 
- 
isBottomRightHorizontalRadiusAsPercentagepublic final boolean isBottomRightHorizontalRadiusAsPercentage()Indicates whetherbottomRightHorizontalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true bottomRightHorizontalRadius is in percentage, otherwise a value
 
- 
isBottomRightVerticalRadiusAsPercentagepublic final boolean isBottomRightVerticalRadiusAsPercentage()Indicates whetherbottomRightVerticalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true bottomRightVerticalRadius is in percentage, otherwise a value
 
- 
isBottomLeftVerticalRadiusAsPercentagepublic final boolean isBottomLeftVerticalRadiusAsPercentage()Indicates whetherbottomLeftVerticalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true bottomLeftVerticalRadius is in percentage, otherwise a value
 
- 
isBottomLeftHorizontalRadiusAsPercentagepublic final boolean isBottomLeftHorizontalRadiusAsPercentage()Indicates whetherbottomLeftHorizontalRadiusis interpreted as a value or a percentage.- Interpolation Type:
- discrete
- Returns:
- if true bottomLeftHorizontalRadius is in percentage, otherwise a value
 
- 
isUniformpublic final boolean isUniform()Indicates whether each corner radius is exactly the same, and each are either uniformly percentage-based or not.- Returns:
- if true each corner radius is uniformly percentage-based, otherwise not
 
- 
interpolateReturns an intermediate value between the value of thisInterpolatableand the specifiedendValueusing the linear interpolation factort, 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 interface- Interpolatable<CornerRadii>
- Parameters:
- endValue- the target value
- t- the interpolation factor
- Returns:
- the intermediate value
- Throws:
- NullPointerException- if- endValueis- null
- Since:
- 24
 
 
-