-
Enhancement
-
Resolution: Fixed
-
P4
-
8u45, 9, 10
-
x86_64
-
windows_7
A DESCRIPTION OF THE REQUEST :
The bounds class provides you with min/max x and y coordinates as well as width and height. A very frequent use case is to get the center. So you have to code all the time, e. g. for the x coordinate
getMinX() + getWidth() / 2.0
It would be very helpful and more readable if the Bounds method would simply support a getCenterX() method.
JUSTIFICATION :
Helps readability and solves a frequent use case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
getCenterX() would return getMinX() + getWidth() / 2.0
getCenterY() would return getMinY() + getHeight() / 2.0
ACTUAL -
There is no such method. Except for the Circle node, but why the Circle node is the exception is beyond me.
The bounds class provides you with min/max x and y coordinates as well as width and height. A very frequent use case is to get the center. So you have to code all the time, e. g. for the x coordinate
getMinX() + getWidth() / 2.0
It would be very helpful and more readable if the Bounds method would simply support a getCenterX() method.
JUSTIFICATION :
Helps readability and solves a frequent use case.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
getCenterX() would return getMinX() + getWidth() / 2.0
getCenterY() would return getMinY() + getHeight() / 2.0
ACTUAL -
There is no such method. Except for the Circle node, but why the Circle node is the exception is beyond me.
- csr for
-
JDK-8199894 Enhance the Bounds class with getCenter method
-
- Closed
-
- is blocked by
-
JDK-8200749 Update javadoc build to enable tags used by JDK and fix broken URL
-
- Resolved
-