0

I want to create a GridPane with 3 columns in JavaFX using FXML. There is a big label in center column. The center column takes the width of the label. The left and right column share each half (50%) of the remaining width of the form. I tried PercentWidth to 50 to left and right columns. However, the widths are set to 50 percent of the whole form but not the remaining width. For instance, the form is 1000px width. The center column may take 400px while the left and right column each takes 300px. This formula should maintain even if the form is resize during run time.

M. Ko
  • 563
  • 6
  • 31
  • I am switching from C# tablelayoutpanel control to JavaFX and hence, I thought GridPane will behave like TableLayoutPanel in C# – M. Ko Jan 26 '17 at 05:05

1 Answers1

0

Just make the center column use USE_COMPUTED_SIZE for preferred width, and for the other 2 columns, set HGrow to ALWAYS. Also set SOMETIMES for center column's HGrow.

Jai
  • 8,165
  • 2
  • 21
  • 52