Java FX - 在GridPane上绘制时错误的线条定位

时间:2017-06-19 18:15:10

标签: java javafx javafx-8

我有以下代码:

    Button loadChunksButton = new Button("Load chunks");
    loadChunksButton.setOnAction(new LoadChunksButtonListener());

    GridPane gridPane = new GridPane();

    gridPane.setMinSize(400, 200);
    gridPane.setPadding(new Insets(10, 10, 10, 10));
    gridPane.setVgap(5);
    gridPane.setHgap(5);
    gridPane.add(loadChunksButton, 0, 0);
    gridPane.add(chunksListView, 0, 1);

    gridPane.add(new Line(0, 0, 250, 250), 1, 1);
    gridPane.add(new Line(0, 0, 250, 0), 1, 1);

结果如下面的屏幕。为什么这两行不是从同一点开始,尽管两者都指定了(0,0)作为起点?如何使用红色箭头指向的绝对值(0,0)?

enter image description here

0 个答案:

没有答案