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

Enhance the Bounds class with getCenter method

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 8u45, 9, 10
    • jfx11
    • javafx
    • x86_64
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: