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

width and height variables on LayoutInfo do not set the Node width/height

XMLWordPrintable

      Identified in JavaFX 1.2 build 8.

      The LayoutInfo class has variables called width and height that do not set the Node width and height, but instead override the preferred width and height of the Node.

      This is potentially misleading, because it is identically named to Resizable.width and Resizable.height, which do set the Node width and height.

      This is inconsistent, because prefWidth/prefHeight are used for the same concept in the following places in the API:
      * Panel.prefWidth, Panel.prefHeight
      * Resizable.getPrefWidth, Resizable.getPrefHeight
      * Container.getNodePrefWidth, Container.getNodePrefHeight

      It is even internally consistent, because as of build 8, LayoutInfo has the following sibling variables:
      * maxWidth/maxHeight - maximum width and height override
      * minWidth/minHeight - minimum width and height override

      The expected (and proposed) naming would be to have preferred width and height be called:
      * prefWidth/prefHeight

      I understand API changes are hard to make, but I think the benefit of catching this before the 1.2 release goes out is worth consideration, especially since there will be a lot of focus on the new layout system. Making this small change will reduce confusion around min/max/preferred sizes, which is already a hard concept for some developers to grasp.

            amfowler Anne Fowler (Inactive)
            schin Stephen Chin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: