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

PopupWindow reports incorrect width and height

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • javafx
    • 8.0-graphics-scrum-b1007-x64, Windows 7 x64

    Description

      I've noticed that CustomColorDialog appears shifted from the right edge of ColorPalette PopupWindow. In fact, my investigation shows that PopupWindow x, y, width, height rectangle is shifted to the right and bottom from the actual position.

      To illustrate that I've changed ColorPalette code so when you click on Custom Color link it opens four stages each is expected to be adjacent to Palette window. In fact, only top and left are adjucent while bottom and right are at a distance. See attached screenshot.

      The problem is caused by PopupWindow.syncWithRootBounds() method which does some "black" magic behind the scenes:

              // update popup dimensions
              setWidth(layoutBounds.getMaxX() - layoutBounds.getMinX());
              setHeight(layoutBounds.getMaxY() - layoutBounds.getMinY());
              // update transform
              rootNode.setTranslateX(-layoutBounds.getMinX());
              rootNode.setTranslateY(-layoutBounds.getMinY());
              if (alignWithContentOrigin) {
                  // update window position
                  setWindowTranslate(layoutBounds.getMinX(), layoutBounds.getMinY());
                  ...
              }

      The root cause is that root node has shadow and the shadow contributes to width and height of the PopupWindow but doesn't affect its x and y.

      Attachments

        Issue Links

          Activity

            People

              lnerad Ľubomír Nerád
              mrkam Alexander Kuznetcov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: