Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8130379

Enhance the Bounds class with getCenter method

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u45, 9, 10
    • Fix Version/s: openjfx11
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nlisker Nir Lisker
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: