Example usage for javafx.scene.control Pagination Pagination

List of usage examples for javafx.scene.control Pagination Pagination

Introduction

In this page you can find the example usage for javafx.scene.control Pagination Pagination.

Prototype

public Pagination(int pageCount, int pageIndex) 

Source Link

Document

Constructs a new Pagination control with the specified page count and page index.

Usage

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    fonts = Font.getFamilies().toArray(fonts);
    pagination = new Pagination(fonts.length / itemsPerPage(), 0);
    pagination.setPageFactory((Integer pageIndex) -> createPage(pageIndex));

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(pagination, 10.0);
    AnchorPane.setRightAnchor(pagination, 10.0);
    AnchorPane.setBottomAnchor(pagination, 10.0);
    AnchorPane.setLeftAnchor(pagination, 10.0);
    anchor.getChildren().addAll(pagination);
    Scene scene = new Scene(anchor, 400, 450);
    stage.setScene(scene);//from   w w w . j a v a 2  s.c  om
    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    pagination = new Pagination(28, 0);
    pagination.setPageFactory((Integer pageIndex) -> {
        if (pageIndex >= textPages.length) {
            return null;
        } else {//w  w  w  .jav  a2  s.c om
            return createPage(pageIndex);
        }
    });

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(pagination, 10.0);
    AnchorPane.setRightAnchor(pagination, 10.0);
    AnchorPane.setBottomAnchor(pagination, 10.0);
    AnchorPane.setLeftAnchor(pagination, 10.0);
    anchor.getChildren().addAll(pagination);
    Scene scene = new Scene(anchor, 400, 250);
    stage.setScene(scene);
    stage.setTitle("PaginationSample");
    stage.show();
}