我已经创建了两个 Javafx Gridpanes,我希望它们在同一个 ligne 中,第二个 gridpane 必须在第一个 gridpane 旁边的同一个 ligne 中。因为我在跑步时会得到一个。这是我的代码:
Group root = new Group();
Scene scene = new Scene(root);
//creation du layout
layout = new GridPane();
layout.getColumnConstraints().add(new ColumnConstraints(350)); // column 1 is 350 wide
layout.getColumnConstraints().add(new ColumnConstraints(350));
layout.getColumnConstraints().add(new ColumnConstraints(350));
layout.setGridLinesVisible(true);
final Label source = new Label ("DRAG ");
layout.add(source, 0, 0);
final Label target = new Label ("DROP ");
layout.add(target, 1, 0);
layout2 = new GridPane();
layout2.getColumnConstraints().add(new ColumnConstraints(20)); // column 1 is 20 wide
layout2.setGridLinesVisible(true);
final Label source1 = new Label ("fire");
layout2.add(source1, 0, 4);
root.getChildren().addAll(layout,layout2);