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

Javadoc of Parent, Pane and Region layout behaviour is misunderstandable


    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: None
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:


      I have been struggling with an exception in my application for a while now, and the reason is JavaFX works differently than the docs says. Here is the JavaDocs for class Region for instance:

          "By default a Region inherits the layout behavior of its superclass, Parent, which means that it will resize any resizable child nodes to their preferred size, but will not reposition them."

      It turns out, this is not entirely true. Below I have shown an exception I raised from a Skin placed inside a Region because the resize method is - contrary to what the javadoc above says - in fact invoked to reposition the skin.

      I am not certain why, this works differently than what the docs says, but I recommend correcting the docs to reflect that repositioning does in fact occur, only Region (like Parent and Pane) does not enforce a particular layout concept (like BorderPane or GridPane).

      I am in a region, and relocate was invoked with values -5.0, -11.0 even though the Region javadoc says it wouldn't.
      at com.intuism.ui.component.balloon.BalloonSkin2$1.relocate(BalloonSkin2.java:36)
      at javafx.scene.layout.Region.position(Region.java:2033)
      at javafx.scene.layout.Region.layoutInArea(Region.java:2014)
      at javafx.scene.layout.Region.layoutInArea(Region.java:1915)
      at javafx.scene.layout.StackPane.layoutChildren(StackPane.java:348)
      at javafx.scene.Parent.layout(Parent.java:1018)
      at javafx.scene.Parent.layout(Parent.java:1028)
      at javafx.scene.Scene.layoutDirtyRoots(Scene.java:513)
      at javafx.scene.Scene.doLayoutPass(Scene.java:484)
      at javafx.scene.Scene.access$3900(Scene.java:169)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2199)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:363)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460)
      at com.sun.javafx.tk.quantum.QuantumToolkit$9.run(QuantumToolkit.java:329)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
      Aug 29, 2012 5:12:44 PM com.intuism.ui.component.balloon.BalloonSkin2 autonomousLayout
      INFO: Auto layout 1122.0, 355.0, 330.0, 27.0




            • Assignee:
              msladecek Martin Sládeček
              risaksen Randahl Isaksen
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: