I use a splitPane with 4 Nodes inside without size limits. But when I try to split it, it doesn't work.
Code Used
m_Split.setDividerPosition(0, 0.25);
m_Split.setDividerPosition(1, 0.5);
m_Split.setDividerPosition(2, 0.75);
double tab[] = m_Split.getDividerPositions();
for(int i=0; i < tab.length; i++)
{
System.out.println("i=" + i + " pos=" + tab[i]);
}
The code is in a function started with Platform.runLater(new Runnable) and the run() function.
Output
i= 0 pos=0.2505854800936768
i= 1 pos=0.5
i= 2 pos=0.7505854800936768
But with others position values
i=0 pos=0.2997658079625293
i=1 pos=0.5
i=2 pos=1.0
with 0.3, 0.6 and 1.0 and
i=0 pos=0.5
i=1 pos=0.5
i=2 pos=1.0
with 0.5, 1.0 and 1.0 values
I use Java 1.8 and Java FX 8
Thanks
You have not given a full example to reproduce your problem so we can only guess. The likeliest reason for the issue you describe is that you have added children to the split pane and they have maximum/minimum sizes which are not compatible with your divider constraints. The javadoc states (emphasis mine):
Setting the divider position greater than the node's maximum size position will result in the divider being set at the node's maximum size position. Setting the divider position less than the node's minimum size position will result in the divider being set at the node's minimum size position. Therefore the value set in
setDividerPosition(int, double)
andsetDividerPositions(double...)
may not be the same as the value returned bygetDividerPositions()
.