Search code examples
javalayoutjavafxjavafx-2gridpanel

javafx 2 gridpane rows overlap when using percentHeight


I am trying to layout my screen in JavaFX and have trouble using GridPane. I have 2 rows - one of them is set to have percentHeight of 80 and the other of 20 but what I'm seeing is that one row is overlaping the other

here is a little illustration (if you can call it like that :) ) that hopefully demonstrates what I mean (numbers indicate row numbers and '*' represents the overlap)

1   label1     <--- belongs to row 1
1   list1
1   |
1   | 
1   |
12  |  *  label2   <---  belongs to row 2
12  |  *  list2
 2        |
 2        |

anyone encountered this problem? did I do something wrong?


Solution

  • Just find out what was wrong - in my layout i used nested gridpanes that their content was auto - generated without adding row constraints..

    As it found out if no row constraints is added to the gridpane a default ones is used, those defaults had a minimum size, this cause the gridpanes them self to have "undeclared"/implicit minimum size, this why the constraints that i added (80 : 20 percent) was ignored - because the implicit minimum size of the different grids didn't left too much room for re-sizing, finally - because after calculating the minimum size of the grids there is not enough space in the page to show them - they overlaps.

    the disappointing thing is - that i used showGridLines and the lines shown didn't reflect the minimum row size.

    the problem was solved after i manually added the row constraints with minimum size of 0.