Pagination_NodeCallBack1
 
Code:

package javafxtemplate1;
//Grid_Transform1.htm
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Pagination;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.util.Callback;

/**
*
* @author Manas9
*/
public class JavaFXTemplate1 extends Application {
private static final int PAGE_COUNT = 10;

//
@Override
public void start(Stage primaryStage) {
Pagination pagination = new Pagination(PAGE_COUNT);
pagination.setPageFactory(new Callback<Integer, Node>() {
@Override
public Node call(Integer pageIndex) {
return getLabel(pageIndex);
}
});
VBox root = new VBox(pagination);
Scene scene = new Scene(root, 250,100);
primaryStage.setScene(scene);
primaryStage.setTitle("CallBack Node::Pagination");
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}
public Label getLabel(int pageIndex) {
Label label1 = null;

if (pageIndex >= 0 && pageIndex < PAGE_COUNT) {
label1 = new Label(" Page " + (pageIndex + 1) + " / "+ (PAGE_COUNT));
}
return label1;
}
}

runtime displays: