Example usage for javafx.geometry VPos CENTER

List of usage examples for javafx.geometry VPos CENTER

Introduction

In this page you can find the example usage for javafx.geometry VPos CENTER.

Prototype

VPos CENTER

To view the source code for javafx.geometry VPos CENTER.

Click Source Link

Document

Indicates centered vertical position.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 500, 200);
    stage.setScene(scene);/*from   ww  w.  j a  va  2  s .c o m*/

    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(2);
    grid.setHgap(5);

    scene.setRoot(grid);

    caption.setFont(Font.font("Verdana", 20));

    GridPane.setConstraints(caption, 0, 0);
    GridPane.setColumnSpan(caption, 8);
    grid.getChildren().add(caption);

    final Separator sepHor = new Separator();
    sepHor.setValignment(VPos.CENTER);
    GridPane.setConstraints(sepHor, 0, 1);
    GridPane.setColumnSpan(sepHor, 7);
    grid.getChildren().add(sepHor);

    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("ObservableLists");
    Group root = new Group();
    Scene scene = new Scene(root, 400, 250, Color.WHITE);

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);//from   w ww .ja  va  2  s  .  c o  m
    gridpane.setVgap(10);

    Label candidatesLbl = new Label("Left");
    GridPane.setHalignment(candidatesLbl, HPos.CENTER);
    gridpane.add(candidatesLbl, 0, 0);

    Label heroesLbl = new Label("Right");
    gridpane.add(heroesLbl, 2, 0);
    GridPane.setHalignment(heroesLbl, HPos.CENTER);

    final ObservableList<String> lefts = FXCollections.observableArrayList("A", "B", "C");
    final ListView<String> leftListView = new ListView<String>(lefts);
    leftListView.setPrefWidth(150);
    leftListView.setPrefHeight(150);

    gridpane.add(leftListView, 0, 1);

    final ObservableList<String> rights = FXCollections.observableArrayList();
    final ListView<String> rightListView = new ListView<String>(rights);
    rightListView.setPrefWidth(150);
    rightListView.setPrefHeight(150);

    gridpane.add(rightListView, 2, 1);

    Button sendRightButton = new Button(">");
    sendRightButton.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            String item = leftListView.getSelectionModel().getSelectedItem();
            if (item != null) {
                leftListView.getSelectionModel().clearSelection();
                lefts.remove(item);
                rights.add(item);
            }
        }
    });

    Button sendLeftButton = new Button("<");
    sendLeftButton.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            String item = rightListView.getSelectionModel().getSelectedItem();
            if (item != null) {
                rightListView.getSelectionModel().clearSelection();
                rights.remove(item);
                lefts.add(item);
            }
        }
    });

    VBox vbox = new VBox(5);
    vbox.getChildren().addAll(sendRightButton, sendLeftButton);

    gridpane.add(vbox, 1, 1);
    GridPane.setConstraints(vbox, 1, 1, 1, 2, HPos.CENTER, VPos.CENTER);

    root.getChildren().add(gridpane);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:webviewsample.Main.java

@Override
protected void layoutChildren() {
    double w = getWidth();
    double h = getHeight();
    double tbHeight = toolBar.prefHeight(w);
    layoutInArea(browser, 0, 0, w, h - tbHeight, 0, HPos.CENTER, VPos.CENTER);
    layoutInArea(toolBar, 0, h - tbHeight, w, tbHeight, 0, HPos.CENTER, VPos.CENTER);
}

From source file:com.offbynull.voip.ui.UiWebRegion.java

@Override
protected void layoutChildren() {
    double w = getWidth();
    double h = getHeight();
    layoutInArea(webView, 0, 0, w, h, 0, HPos.CENTER, VPos.CENTER);
}

From source file:de.ks.idnadrev.information.chart.ChartDataEditor.java

protected void addRowConstraint() {
    dataContainer.getRowConstraints().add(new RowConstraints(30, Control.USE_COMPUTED_SIZE,
            Control.USE_COMPUTED_SIZE, Priority.NEVER, VPos.CENTER, true));
}

From source file:Main.java

@Override
public void init() {
    int axisLabelPos = AXIS_LENGTH + ARROW_LENGTH + 4;
    localXAxisLabel.setLayoutX(axisLabelPos);
    localXAxisLabel.setTextOrigin(VPos.CENTER);
    localYAxisLabel.setLayoutY(axisLabelPos);
    localYAxisLabel.setTextOrigin(VPos.CENTER);

    parentXAxisLabel.setLayoutX(axisLabelPos);
    parentXAxisLabel.setTextOrigin(VPos.CENTER);
    parentYAxisLabel.setLayoutY(axisLabelPos);
    parentYAxisLabel.setTextOrigin(VPos.CENTER);

    String textFont = "-fx-font-size:9;";
    localXAxisLabel.setStyle(textFont);/* w  w  w .  j  a  v a2  s.  co  m*/
    localYAxisLabel.setStyle(textFont);
    parentXAxisLabel.setStyle(textFont);
    parentYAxisLabel.setStyle(textFont);

    mainRect.setFill(RECTANGLE_FILL_COLOR);
    rectFillColorChoiceBox.setValue(RECTANGLE_FILL_COLOR_STR);
    rectStrokeColorChoiceBox.setValue(RECTANGLE_STROKE_COLOR_STR);

    initializeBoundsDetails();
    initializeBoundsPathTransition();

    // Bind labels to slider values
    bindLabelsToSliders();

    // Initialize Bounds Table View
    initializeBoundsTableView();
}

From source file:org.mskcc.shenkers.control.alignment.AlignmentOverlay.java

private void populateGridPane() {
    ObservableList<Node> children = this.getChildren();
    children.clear();/* w w w . jav  a 2  s  .c  om*/
    int l = nodes.size();
    boolean flip = flipProperty.get();

    for (int i = 0; i < l; i++) {
        Node n = nodes.get(i);
        GridPane.setHalignment(n, HPos.CENTER);
        GridPane.setValignment(n, VPos.CENTER);
        GridPane.setHgrow(n, Priority.ALWAYS);
        GridPane.setVgrow(n, Priority.ALWAYS);
        GridPane.setRowIndex(n, 0);
        GridPane.setColumnIndex(n, flip ? l - i - 1 : i);
        children.add(n);
    }
}