SplitPane layout question

Florian Brunner fbrunnerlist at gmx.ch
Mon Jan 5 21:35:48 UTC 2015


Hi Scott,

Thanks for your answer.

Unfortunatly, I still couldn't fix this issue.

I tried several things including setting the prefWidth/ prefHeight of the 
items to the expected value, but I couldn't stop the SplitPane to effectively 
"hide" the first and the third (last) item during a re-layout.

The two dividers changed during the layoutChildren call as follows:

Divider position changed: old value: 0.10857763300760044, new value: 
0.004343105320304018

Divider position changed: old value: 0.8914223669923995, new value: 
0.995656894679696

I had a look at the com.sun.javafx.scene.control.skin.SplitPaneSkin (source 
code provided with the JDK), but unfortunatly it's not easy there to see how 
the areas are calculated in this situation.

You mentioned the min/ max sizes. Just for testing purposes I also set the 
minHeight/ minWidth but this only had the effect that I couldn't readjust the 
divider with the mouse anymore. During the re-layout the issue still 
persisted.

What else could I try?

-Florian

Am Montag, 22. Dezember 2014, 07.19:37 schrieb Scott Palmer:
> The min/max sizes of the children are probably being respected.
> 
> Scott
> 
> > On Dec 22, 2014, at 7:13 AM, Florian Brunner <fbrunnerlist at gmx.ch> wrote:
> > 
> > Hi,
> > 
> > Sometimes when I'm setting the divider positions of a SplitPane
> > programmatically my value get overridden again by some JavaFX internal
> > layout code.
> > 
> > For debugging purposes I've added a listener to the position property of
> > the divider and have thrown a RuntimeException to see the stack trace. It
> > looks like this:
> > 
> > --------------------------------------------------------------------------
> > ---------------- at
> > com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(Expr
> > essionHelper.java:361)> 
> >    at
> > 
> > com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHe
> > lper.java:81)> 
> >    at
> > 
> > javafx.beans.property.DoublePropertyBase.fireValueChangedEvent(DoublePrope
> > rtyBase.java:106)> 
> >    at
> > 
> > javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.ja
> > va:113)> 
> >    at
> > 
> > javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:146)
> > 
> >    at
> >    javafx.scene.control.SplitPane$Divider.setPosition(SplitPane.java:486)
> >    at
> > 
> > com.sun.javafx.scene.control.skin.SplitPaneSkin.setAbsoluteDividerPos(Spli
> > tPaneSkin.java:310)> 
> >    at
> > 
> > com.sun.javafx.scene.control.skin.SplitPaneSkin.setupContentAndDividerForL
> > ayout(SplitPaneSkin.java:502)> 
> >    at
> > 
> > com.sun.javafx.scene.control.skin.SplitPaneSkin.layoutChildren(SplitPaneSk
> > in.java:817)> 
> >    at javafx.scene.control.Control.layoutChildren(Control.java:589)
> >    at javafx.scene.Parent.layout(Parent.java:1074)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Parent.layout(Parent.java:1080)
> >    at javafx.scene.Scene.doLayoutPass(Scene.java:532)
> >    at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2363)
> >    at com.sun.javafx.tk.Toolkit.lambda$runPulse$28(Toolkit.java:314)
> >    at com.sun.javafx.tk.Toolkit$$Lambda$230/25595560.run(Unknown Source)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:313)
> >    at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:340)
> >    at
> >    com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:451
> >    )
> >    at
> >    com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:431
> >    )
> >    at
> > 
> > com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$363(QuantumTool
> > kit.java:298)> 
> >    at
> > 
> > com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$59/174792896.run(Unknown
> > Source)
> > 
> >    at
> > 
> > com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.ja
> > va:95)> 
> >    at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
> >    at
> > 
> > com.sun.glass.ui.gtk.GtkApplication.lambda$null$45(GtkApplication.java:126
> > )
> > 
> >    at
> >    com.sun.glass.ui.gtk.GtkApplication$$Lambda$55/1472148546.run(Unknown
> > 
> > Source)
> > 
> >    at java.lang.Thread.run(Thread.java:745)
> > 
> > --------------------------------------------------------------------------
> > ----------------
> > 
> > It doesn't seem to get triggered by some code of mine (at least not
> > directly according to the stack trace).
> > 
> > Why is this re-layout happing here?
> > Why does it override the values I've set for the divider positions?
> > How can stop this?
> > 
> > Thanks for some insights.
> > 
> > -Florian



More information about the openjfx-dev mailing list