0
我創建了兩個Javafx Gridpanes,我希望它們處於同一個ligne中,第二個gridpane必須位於第一個gridpane旁邊的相同ligne中。因爲我在跑步時得到一個。 這是我的代碼:對齊兩個Javafx GridPane
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);
它爲我工作,非常感謝你:) –
@hamza_don不客氣。 –