javafx中的java分页

eyh26e7m  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(234)

我在查看两个不同页面上的两个选项卡时遇到问题。我有两个标签叫做 sgp = new SetupGamePane();orp = new OverviewResultPane(); . 这些都是根目录类和实现分页视图系统上的不同类。当我运行程序时,我只能看到 orp = new OverviewResultPane(); 两页上都有一页。如何在第1页和第2页申请sgp。请参阅下面的代码。

package view;

import javafx.scene.control.Pagination;

public class DiceGameRootPane extends Pagination {

    private SetupGamePane sgp;
    private OverviewResultPane orp;
    private Pagination p1, p2;

    public DiceGameRootPane() {

        this.setPageCount(2);
        this.setCurrentPageIndex(0);
        this.setStyle("-fx-border-color : blue");

        sgp = new SetupGamePane();
        orp = new OverviewResultPane();

        Pagination p1 = new Pagination(0);
        this.setPageFactory(e -> getSetupGamePane());

        Pagination p2 = new Pagination(1);
        this.setPageFactory(e -> getOverviewResultsPane());

        this.getChildren().addAll(p1, p2);

    }

    public SetupGamePane getSetupGamePane() {
        return  sgp;
    }

    public OverviewResultPane getOverviewResultsPane() {
        return orp;
    }
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题