Example usage for javafx.geometry Pos BOTTOM_CENTER

List of usage examples for javafx.geometry Pos BOTTOM_CENTER

Introduction

In this page you can find the example usage for javafx.geometry Pos BOTTOM_CENTER.

Prototype

Pos BOTTOM_CENTER

To view the source code for javafx.geometry Pos BOTTOM_CENTER.

Click Source Link

Document

Represents positioning on the bottom vertically and on the center horizontally.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group group = new Group();
    Scene scene = new Scene(group);

    Label title = new Label("Label 1");
    StackPane stackpane = new StackPane();
    StackPane.setAlignment(title, Pos.BOTTOM_CENTER);
    stackpane.getChildren().addAll(new Label("Label"), title);

    group.getChildren().add(stackpane);/*  w ww.  j a  v  a  2 s.  c om*/

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();
}

From source file:main.TestManager.java

/**
 * Displays given test. Intended for testing and
 * evaluating correct answers. (student mode only)
 * @param test test to display/*from   w  w w  . j a  v a 2  s.c om*/
 * @param stage 
 */
public static void displayTest(Test test, Stage stage) {
    Debugger.println(test.getName() + " - is displayed.");
    TabPane tabPane = new TabPane();
    int counter = 1;
    for (Question q : test.getQuestions()) {
        Label instruction = new Label(q.question);
        instruction.setStyle("-fx-font-size: 20");
        Pane choices = q.getPaneOfChoices();
        VBox vbox = new VBox(instruction, choices);
        vbox.setSpacing(10);
        Tab tab = new Tab("Otzka " + Integer.toString(counter), vbox);
        tab.setStyle("-fx-font-size: 20");
        tabPane.getTabs().add(tab);
        counter++;
    }

    Button finish = new Button("Ukon?i test!");
    finish.setStyle("-fx-font-size: 20");
    finish.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            try {
                test.evaluate(stage);
            } catch (IOException e) {
                Alert alert = new Alert(AlertType.ERROR);
                alert.setContentText("Ojoj, vyskytol sa problm. Aplikcia sa mus ukon?i.");
                alert.showAndWait();
                System.exit(0);
            }
        }
    });
    Button nextQuestion = new Button("alia");
    nextQuestion.setStyle("-fx-font-size: 20");
    nextQuestion.setOnAction(e -> tabPane.getSelectionModel().selectNext());
    HBox buttons = new HBox(finish, nextQuestion);
    buttons.setSpacing(10);
    buttons.setAlignment(Pos.BOTTOM_CENTER);
    VBox outerVBox = new VBox(tabPane, buttons);
    outerVBox.setPadding(new Insets(10, 10, 10, 10));
    Scene scene = new Scene(outerVBox);
    stage.setScene(scene);
    stage.show();
}

From source file:gov.va.isaac.gui.preferences.PreferencesViewController.java

public void aboutToShow() {
    // Using allValid_ to prevent rerunning content of aboutToShow()
    if (allValid_ == null) {
        // These listeners are for debug and testing only. They may be removed at any time.
        UserProfileBindings userProfileBindings = AppContext.getService(UserProfileBindings.class);
        for (Property<?> property : userProfileBindings.getAll()) {
            property.addListener(new ChangeListener<Object>() {
                @Override//from   ww  w .j a va  2s .  c o  m
                public void changed(ObservableValue<? extends Object> observable, Object oldValue,
                        Object newValue) {
                    logger.debug("{} property changed from {} to {}", property.getName(), oldValue, newValue);
                }
            });
        }

        // load fields before initializing allValid_
        // in case plugin.validationFailureMessageProperty() initialized by getNode()
        tabPane_.getTabs().clear();
        List<PreferencesPluginViewI> sortableList = new ArrayList<>();
        Comparator<PreferencesPluginViewI> comparator = new Comparator<PreferencesPluginViewI>() {
            @Override
            public int compare(PreferencesPluginViewI o1, PreferencesPluginViewI o2) {
                if (o1.getTabOrder() == o2.getTabOrder()) {
                    return o1.getName().compareTo(o2.getName());
                } else {
                    return o1.getTabOrder() - o2.getTabOrder();
                }
            }
        };
        for (PreferencesPluginViewI plugin : plugins_) {
            sortableList.add(plugin);
        }
        Collections.sort(sortableList, comparator);
        for (PreferencesPluginViewI plugin : sortableList) {
            logger.debug("Adding PreferencesPluginView tab \"{}\"", plugin.getName());
            Label tabLabel = new Label(plugin.getName());

            tabLabel.setMaxHeight(Double.MAX_VALUE);
            tabLabel.setMaxWidth(Double.MAX_VALUE);
            Tab pluginTab = new Tab();
            pluginTab.setGraphic(tabLabel);
            Region content = plugin.getContent();
            content.setMaxWidth(Double.MAX_VALUE);
            content.setMaxHeight(Double.MAX_VALUE);
            content.setPadding(new Insets(5.0));

            Label errorMessageLabel = new Label();
            errorMessageLabel.textProperty().bind(plugin.validationFailureMessageProperty());
            errorMessageLabel.setAlignment(Pos.BOTTOM_CENTER);
            TextErrorColorHelper.setTextErrorColor(errorMessageLabel);

            VBox vBox = new VBox();
            vBox.getChildren().addAll(errorMessageLabel, content);
            vBox.setMaxWidth(Double.MAX_VALUE);
            vBox.setAlignment(Pos.TOP_CENTER);

            plugin.validationFailureMessageProperty().addListener(new ChangeListener<String>() {
                @Override
                public void changed(ObservableValue<? extends String> observable, String oldValue,
                        String newValue) {
                    if (newValue != null && !StringUtils.isEmpty(newValue)) {
                        TextErrorColorHelper.setTextErrorColor(tabLabel);
                    } else {
                        TextErrorColorHelper.clearTextErrorColor(tabLabel);
                    }
                }
            });
            //Initialize, if stored value is wrong
            if (StringUtils.isNotEmpty(plugin.validationFailureMessageProperty().getValue())) {
                TextErrorColorHelper.setTextErrorColor(tabLabel);
            }
            pluginTab.setContent(vBox);
            tabPane_.getTabs().add(pluginTab);
        }

        allValid_ = new ValidBooleanBinding() {
            {
                ArrayList<ReadOnlyStringProperty> pluginValidationFailureMessages = new ArrayList<>();
                for (PreferencesPluginViewI plugin : plugins_) {
                    pluginValidationFailureMessages.add(plugin.validationFailureMessageProperty());
                }
                bind(pluginValidationFailureMessages
                        .toArray(new ReadOnlyStringProperty[pluginValidationFailureMessages.size()]));
                setComputeOnInvalidate(true);
            }

            @Override
            protected boolean computeValue() {
                for (PreferencesPluginViewI plugin : plugins_) {
                    if (plugin.validationFailureMessageProperty().get() != null
                            && plugin.validationFailureMessageProperty().get().length() > 0) {
                        this.setInvalidReason(plugin.validationFailureMessageProperty().get());

                        logger.debug("Setting PreferencesView allValid_ to false because \"{}\"",
                                this.getReasonWhyInvalid().get());
                        return false;
                    }
                }

                logger.debug("Setting PreferencesView allValid_ to true");

                this.clearInvalidReason();
                return true;
            }
        };

        okButton_.disableProperty().bind(allValid_.not());
        // set focus on default
        // Platform.runLater(...);
    }

    // Reload persisted values every time view opened
    for (PreferencesPluginViewI plugin : plugins_) {
        plugin.getContent();
    }
}

From source file:de.unibw.inf2.fishification.buttons.ButtonManager.java

/**
 * Initializes utilities buttons./*from w w  w .j a  va 2s .  co m*/
 */
private void initUtilButtons() {

    // Create Buttons and Pane
    createCentricButtons();
    createPauseButton();
    createRefreshButton();
    TilePane utilButtonsPane = createUtilPane();

    // Align and assign to Layout Pane
    AnchorPane.setLeftAnchor(utilButtonsPane, BORDER_SPACING);
    AnchorPane.setRightAnchor(utilButtonsPane, BORDER_SPACING);
    AnchorPane.setBottomAnchor(utilButtonsPane, BORDER_SPACING_BOTTOM);
    utilButtonsPane.setAlignment(Pos.BOTTOM_CENTER);
    m_layoutPane.getChildren().add(utilButtonsPane);

}

From source file:open.dolphin.client.MainWindowController.java

/**
 * align text of the cell to center in the specified column
 *
 * @param col table column to be aligned to center
 *///w  ww . j a  v a2  s.  c  om
private void tableCellAlignCenter(TableColumn col) {
    col.setCellFactory(new Callback<TableColumn, TableCell>() {
        @Override
        public TableCell call(TableColumn param) {
            TableCell cell = new TableCell() {
                @Override
                public void updateItem(Object item, boolean empty) {
                    if (item != null) {
                        setText(item.toString());
                    }
                }
            };
            cell.setAlignment(Pos.BOTTOM_CENTER);
            return cell;
        }
    });
}

From source file:open.dolphin.client.MainWindowController.java

/**
 * align Image of the cell to center in the specified column
 *
 * @param col table column to be aligned to center
 *///from  ww w .  java  2  s  .  co  m
private void tableCellImageAlignCenter(TableColumn col) {
    col.setCellFactory(new Callback<TableColumn, TableCell>() {
        @Override
        public TableCell call(TableColumn param) {
            TableCell cell = new TableCell() {
                @Override
                public void updateItem(Object item, boolean empty) {
                    String imagesPath = "/resources/images/";

                    super.updateItem(item, empty);
                    if (!empty) {
                        switch (item.toString()) {
                        case "0":
                            setTooltip(new Tooltip(""));
                            folderIcon = new Image(imagesPath + "os_folder_vertical_document_16.png");
                            break;
                        case "1":
                            setTooltip(new Tooltip("/??"));
                            folderIcon = new Image(imagesPath + "os_network_wireless_16.png");
                            break;
                        case "2":
                            setTooltip(new Tooltip("/??"));
                            folderIcon = new Image(imagesPath + "os_server_information_16.png");
                            break;
                        case "3":
                            setTooltip(new Tooltip("/"));
                            folderIcon = new Image(imagesPath + "os_cog_16.png");
                            break;
                        case "4":
                            setTooltip(new Tooltip(""));
                            folderIcon = new Image(imagesPath + "os_hot_16.png");
                            break;
                        case "5":
                            setTooltip(new Tooltip(""));
                            folderIcon = new Image(imagesPath + "os_cart_16.png");
                            break;
                        case "6":
                            setTooltip(new Tooltip(""));
                            folderIcon = new Image(imagesPath + "os_cancel_16.png");
                            break;
                        case "8":
                            setTooltip(new Tooltip(""));
                            folderIcon = new Image(imagesPath + "os_flag_yellow_16.png");
                            break;
                        }
                        setGraphic(new ImageView(folderIcon));
                    }
                }
            };
            cell.setAlignment(Pos.BOTTOM_CENTER);
            return cell;
        }
    });
}