Example usage for javafx.scene.layout StackPane setAlignment

List of usage examples for javafx.scene.layout StackPane setAlignment

Introduction

In this page you can find the example usage for javafx.scene.layout StackPane setAlignment.

Prototype

public static void setAlignment(Node child, Pos value) 

Source Link

Document

Sets the alignment for the child when contained by a stackpane.

Usage

From source file:com.panemu.tiwulfx.table.TableControl.java

private void initControls() {
    this.getStyleClass().add("table-control");
    btnAdd = buildButton(TiwulFXUtil.getGraphicFactory().createAddGraphic());
    btnDelete = buildButton(TiwulFXUtil.getGraphicFactory().createDeleteGraphic());
    btnEdit = buildButton(TiwulFXUtil.getGraphicFactory().createEditGraphic());
    btnExport = buildButton(TiwulFXUtil.getGraphicFactory().createExportGraphic());
    btnReload = buildButton(TiwulFXUtil.getGraphicFactory().createReloadGraphic());
    btnSave = buildButton(TiwulFXUtil.getGraphicFactory().createSaveGraphic());

    btnFirstPage = new Button();
    btnFirstPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageFirstGraphic());
    btnFirstPage.setOnAction(paginationHandler);
    btnFirstPage.setDisable(true);/*from www .j  a v a 2 s .c o  m*/
    btnFirstPage.setFocusTraversable(false);
    btnFirstPage.getStyleClass().addAll("pill-button", "pill-button-left");

    btnPrevPage = new Button();
    btnPrevPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPagePrevGraphic());
    btnPrevPage.setOnAction(paginationHandler);
    btnPrevPage.setDisable(true);
    btnPrevPage.setFocusTraversable(false);
    btnPrevPage.getStyleClass().addAll("pill-button", "pill-button-center");

    btnNextPage = new Button();
    btnNextPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageNextGraphic());
    btnNextPage.setOnAction(paginationHandler);
    btnNextPage.setDisable(true);
    btnNextPage.setFocusTraversable(false);
    btnNextPage.getStyleClass().addAll("pill-button", "pill-button-center");

    btnLastPage = new Button();
    btnLastPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageLastGraphic());
    btnLastPage.setOnAction(paginationHandler);
    btnLastPage.setDisable(true);
    btnLastPage.setFocusTraversable(false);
    btnLastPage.getStyleClass().addAll("pill-button", "pill-button-right");

    cmbPage = new ComboBox<>();
    cmbPage.setEditable(true);
    cmbPage.setOnAction(paginationHandler);
    cmbPage.setFocusTraversable(false);
    cmbPage.setDisable(true);
    cmbPage.getStyleClass().addAll("combo-page");
    cmbPage.setPrefWidth(75);

    paginationBox = new HBox();
    paginationBox.setAlignment(Pos.CENTER);
    paginationBox.getChildren().addAll(btnFirstPage, btnPrevPage, cmbPage, btnNextPage, btnLastPage);

    spacer = new Region();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    toolbar = new ToolBar(btnReload, btnAdd, btnEdit, btnSave, btnDelete, btnExport, spacer, paginationBox);
    toolbar.getStyleClass().add("table-toolbar");

    footer = new StackPane();
    footer.getStyleClass().add("table-footer");
    lblRowIndex = new Label();
    lblTotalRow = new Label();
    menuButton = new TableControlMenu(this);
    StackPane.setAlignment(lblRowIndex, Pos.CENTER_LEFT);
    StackPane.setAlignment(lblTotalRow, Pos.CENTER);
    StackPane.setAlignment(menuButton, Pos.CENTER_RIGHT);

    lblTotalRow.visibleProperty().bind(progressIndicator.visibleProperty().not());

    progressIndicator.setProgress(-1);
    progressIndicator.visibleProperty().bind(service.runningProperty());
    toolbar.disableProperty().bind(service.runningProperty());
    menuButton.disableProperty().bind(service.runningProperty());

    footer.getChildren().addAll(lblRowIndex, lblTotalRow, menuButton, progressIndicator);
    VBox.setVgrow(tblView, Priority.ALWAYS);
    getChildren().addAll(toolbar, tblView, footer);

}