Javafx gridpane行索引没有添加到正确的位置

时间:2018-05-23 09:47:55

标签: java javafx

我正在创建一个64x64图块的Gridpane。网格窗格设置为

public class ButtonPanel extends GridPane {

    public ButtonPanel(Node parent) {
        ButtonPanel.setFillHeight(parent, true);
        this.setPrefSize(264,720);
        this.setPadding(new Insets(8));
        this.setVgap(64);
          setGridLinesVisible(true);
        this.setStyle("-fx-background-color: #F1F5F8; -fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.5), 10, 0, 0, 0);");
    }
}

我添加按钮如下:

buttonPanelMain.add(new Button(), 0, 0);
buttonPanelMain.add(new Button(), 0, 1);

在想法中,第一行和第二行中的第0列都有两个按钮。然而,我得到的是这个

enter image description here

正如你所看到的,在...之间留下了一排......如何解决这个问题?

0 个答案:

没有答案