2 Replies Latest reply on Feb 21, 2013 3:28 PM by svanimpe

    Weird behaviour when spanning colums in GridPane

      Using column span seems to influence the size of all the columns spanned in a weird (as in: I can't figure it out) way.
      With the code below, you would expect the second column to be the size of the button (the only node placed directly in it), and the first column to take up all remaining space.
      But for some reason, the second column is bigger than the button. Note that in my original code (way more complex than the example below) the second column was over 300 pixels too wide.

      The only workaround I found was to set the preferred size of the nodes in the first column, and to set a preferred column size as well (see commented lines). Nothing I tried on the second column seemed to have any effect.

      Am I missing something here, or is this a bug ?
      GridPane root = GridPaneBuilder.create()
              .padding(new Insets(10))
      TextField text = new TextField();
      GridPane.setColumnSpan(text, 2);
      root.add(text, 0, 0);
      Button cancel = new Button("Cancel");
      root.add(cancel, 0, 1);
      Button save = new Button("Save");
      root.add(save, 1, 1);
      Scene scene = new Scene(root);
      primaryStage.setTitle("GridPane Span Test");