javafx.scene.control.Pagination Java Examples

The following examples show how to use javafx.scene.control.Pagination. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaginationSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public void start(final Stage stage) throws Exception {
    fonts = Font.getFamilies().toArray(fonts);

    pagination = new Pagination(fonts.length / itemsPerPage(), 0);
    pagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET);
    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);
    stage.setScene(scene);
    stage.setTitle("PaginationSample");
    scene.getStylesheets().add("paginationsample/ControlStyle.css");
    stage.show();
}
 
Example #2
Source File: AllPatientsView.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
@Override
public void initializeParts() {
  pagination = new Pagination();
  pagination.getStyleClass().add("patient-pagination");
  pagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET);
  pagination.pageCountProperty().bind(Bindings.size(cabinet.getAllPatients()));
  pagination.setPageFactory(
      param -> new PatientView(cabinet.getAllPatients().get(param), translator));
}
 
Example #3
Source File: AddModuleView.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void layoutParts() {
  getStyleClass().add(Pagination.STYLE_CLASS_BULLET);
}
 
Example #4
Source File: PresetHandler.java    From game-of-life-java with MIT License 4 votes vote down vote up
public AnchorPane loadPresets(FlowPane base) {
    
    File dir = new File("Presets");
    File[] selectedFiles = dir.listFiles(new FileFilter() {
        @Override
        public boolean accept(File pathname) {
            if (pathname.getName().endsWith(".gofb")){
                presetCount++;
                return true;}
            return false;
        }
    });
    int pr = 0;
    presets = new String[presetCount];
    for (File selectedFile : selectedFiles) {
        presets[pr] = selectedFile.getName().substring(0, selectedFile.getName().length() - 5);
        pr++;
    }

    Pagination presetsPagination = new Pagination(presets.length, 0);
    //pagination.setStyle("-fx-border-color:red;");
    presetsPagination.setPageFactory(new Callback<Integer, Node>() {
        @Override
        public Node call(Integer pageIndex) {
            if (pageIndex >= presets.length) {
                return null;
            } else {
                return createPresetPage(pageIndex, base);
            }
        }
    });

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(presetsPagination, 10.0);
    AnchorPane.setRightAnchor(presetsPagination, 10.0);
    AnchorPane.setBottomAnchor(presetsPagination, 10.0);
    AnchorPane.setLeftAnchor(presetsPagination, 10.0);
    anchor.getChildren().addAll(presetsPagination);
    
    return anchor;
}