A Pagination control is used for navigation between pages of a single content, which has been divided into smaller parts.
The control can be customized to display numeric page indicators or bullet style indicators by
setting the style class STYLE_CLASS_BULLET
. The
maxPageIndicatorCountProperty
can be used to change
the maximum number of page indicators. The property value can also be changed
via CSS using -fx-max-page-indicator-count.
The pageCountProperty
controls the number of
pages this pagination control has. If the page count is
not known INDETERMINATE
should be used as the page count.
The pageFactoryProperty
is a callback function
that is called when a page has been selected by the application or
the user. The function is required for the functionality of the pagination
control. The callback function should load and return the contents of the selected page.
Null should be returned if the selected page index does not exist.
A simple example of how to create a pagination control with ten pages and each page containing ten hyperlinks.
Pagination pagination = new Pagination(10, 0);
pagination.setPageFactory(new Callback<Integer, Node>() {
public Node call(Integer pageIndex) {
VBox box = new VBox(5);
for (int i = 0; i < pageIndex + 10; i++) {
Hyperlink link = new Hyperlink(myurls[i]);
box.getChildren().add(link);
return box;
}
});
}
extends