Example usage for javafx.scene.layout VBox setAlignment

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

Introduction

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

Prototype

public final void setAlignment(Pos value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("VBox Test");

    VBox vb = new VBox();
    vb.setPadding(new Insets(10, 50, 50, 50));
    vb.setSpacing(10);//ww w  .  j  a v a 2  s. com
    vb.setAlignment(Pos.BASELINE_LEFT);
    System.out.println(vb.getSpacing());

    Label lbl = new Label("VBox");
    lbl.setFont(Font.font("Amble CN", FontWeight.BOLD, 24));
    vb.getChildren().add(lbl);

    Button btn1 = new Button();
    btn1.setText("Button1");
    vb.getChildren().add(btn1);

    Button btn2 = new Button();
    btn2.setText("Button2");
    vb.getChildren().add(btn2);

    Button btn3 = new Button();
    btn3.setText("Button3");
    vb.getChildren().add(btn3);

    Button btn4 = new Button();
    btn4.setText("Button4");
    vb.getChildren().add(btn4);

    // Adding VBox to the scene
    Scene scene = new Scene(vb);
    primaryStage.setScene(scene);
    primaryStage.show();

}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("VBox Test");

    VBox vb = new VBox();
    vb.setPadding(new Insets(10, 50, 50, 50));
    vb.setSpacing(10);//from  w  w  w .j av a2s  . co  m
    vb.setAlignment(Pos.BASELINE_LEFT);
    System.out.println(vb.alignmentProperty());

    Label lbl = new Label("VBox");
    lbl.setFont(Font.font("Amble CN", FontWeight.BOLD, 24));
    vb.getChildren().add(lbl);

    Button btn1 = new Button();
    btn1.setText("Button1");
    vb.getChildren().add(btn1);

    Button btn2 = new Button();
    btn2.setText("Button2");
    vb.getChildren().add(btn2);

    Button btn3 = new Button();
    btn3.setText("Button3");
    vb.getChildren().add(btn3);

    Button btn4 = new Button();
    btn4.setText("Button4");
    vb.getChildren().add(btn4);

    // Adding VBox to the scene
    Scene scene = new Scene(vb);
    primaryStage.setScene(scene);
    primaryStage.show();

}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("VBox Test");

    VBox vb = new VBox();
    vb.setPadding(new Insets(10, 50, 50, 50));
    vb.setSpacing(10);//  w  ww.  j av a2  s. com
    vb.setAlignment(Pos.BASELINE_LEFT);
    System.out.println(vb.getAlignment());

    Label lbl = new Label("VBox");
    lbl.setFont(Font.font("Amble CN", FontWeight.BOLD, 24));
    vb.getChildren().add(lbl);

    Button btn1 = new Button();
    btn1.setText("Button1");
    vb.getChildren().add(btn1);

    Button btn2 = new Button();
    btn2.setText("Button2");
    vb.getChildren().add(btn2);

    Button btn3 = new Button();
    btn3.setText("Button3");
    vb.getChildren().add(btn3);

    Button btn4 = new Button();
    btn4.setText("Button4");
    vb.getChildren().add(btn4);

    // Adding VBox to the scene
    Scene scene = new Scene(vb);
    primaryStage.setScene(scene);
    primaryStage.show();

}

From source file:Main.java

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

    GridPane gridpane = new GridPane();
    gridpane.setPadding(new Insets(5));
    gridpane.setHgap(10);/*from www. jav  a 2s  .c o  m*/
    gridpane.setVgap(10);

    ColumnConstraints column1 = new ColumnConstraints(150, 150, Double.MAX_VALUE);
    ColumnConstraints column2 = new ColumnConstraints(50);
    ColumnConstraints column3 = new ColumnConstraints(150, 150, Double.MAX_VALUE);

    column1.setHgrow(Priority.ALWAYS);
    column3.setHgrow(Priority.ALWAYS);

    gridpane.getColumnConstraints().addAll(column1, column2, column3);

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

    // Heroes label
    Label heroesLbl = new Label("Letters");
    gridpane.add(heroesLbl, 2, 0);
    GridPane.setHalignment(heroesLbl, HPos.CENTER);

    final ObservableList<String> candidates = FXCollections.observableArrayList("A", "B", "C", "D");

    final ListView<String> candidatesListView = new ListView<>(candidates);
    gridpane.add(candidatesListView, 0, 1);

    final ObservableList<String> heroes = FXCollections.observableArrayList();
    final ListView<String> heroListView = new ListView<>(heroes);
    gridpane.add(heroListView, 2, 1);

    Button sendRightButton = new Button(" > ");
    sendRightButton.setOnAction((ActionEvent event) -> {
        String potential = candidatesListView.getSelectionModel().getSelectedItem();
        if (potential != null) {
            candidatesListView.getSelectionModel().clearSelection();
            candidates.remove(potential);
            heroes.add(potential);
        }
    });

    Button sendLeftButton = new Button(" < ");
    sendLeftButton.setOnAction((ActionEvent event) -> {
        String notHero = heroListView.getSelectionModel().getSelectedItem();
        if (notHero != null) {
            heroListView.getSelectionModel().clearSelection();
            heroes.remove(notHero);
            candidates.add(notHero);
        }
    });

    // place the buttons
    VBox vbox = new VBox(5);
    vbox.setAlignment(Pos.CENTER);
    vbox.getChildren().addAll(sendRightButton, sendLeftButton);

    GridPane.setHalignment(vbox, HPos.CENTER);
    gridpane.add(vbox, 1, 1);

    // place the grid
    root.setCenter(gridpane);
    GridPane.setVgrow(root, Priority.ALWAYS);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:org.pdfsam.merge.MergeModule.java

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);
    VBox.setVgrow(selectionPane, Priority.ALWAYS);

    pane.getChildren().addAll(selectionPane,
            titledPane(DefaultI18nContext.getInstance().i18n("Merge settings"), mergeOptions),
            titledPane(DefaultI18nContext.getInstance().i18n("Destination file"), destinationPane));
    return pane;/*from   w w  w. j  a  v  a  2s .co  m*/
}

From source file:Main.java

private void createClipList(GridPane grid) {
    final VBox vbox = new VBox(30);
    vbox.setAlignment(Pos.TOP_CENTER);

    final Label clipLabel = new Label("Code Monkey To-Do List:");
    clipLabel.setId("clipLabel");

    final Button getUpButton = new Button("Get Up, Get Coffee");
    getUpButton.setPrefWidth(300);/*from  ww w . j a  va 2 s.  c o m*/
    getUpButton.setOnAction(createPlayHandler(coffeeClip));

    final Button goToJobButton = new Button("Go to Job");
    goToJobButton.setPrefWidth(300);
    goToJobButton.setOnAction(createPlayHandler(jobClip));

    final Button meetingButton = new Button("Have Boring Meeting");
    meetingButton.setPrefWidth(300);
    meetingButton.setOnAction(createPlayHandler(meetingClip));

    final Hyperlink link = new Hyperlink("About Code Monkey...");
    link.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            WebView wv = new WebView();
            wv.getEngine().load("http://www.jonathancoulton.com/2006/04/14/" + "thing-a-week-29-code-monkey/");

            Scene scene = new Scene(wv, 720, 480);

            Stage stage = new Stage();
            stage.setTitle("Code Monkey");
            stage.setScene(scene);
            stage.show();
        }
    });

    vbox.getChildren().addAll(clipLabel, getUpButton, goToJobButton, meetingButton, link);

    GridPane.setHalignment(vbox, HPos.CENTER);
    GridPane.setHgrow(vbox, Priority.ALWAYS);
    GridPane.setVgrow(vbox, Priority.ALWAYS);
    grid.add(vbox, 0, 0, GridPane.REMAINING, 1);
}

From source file:org.pdfsam.rotate.RotateModule.java

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);
    VBox.setVgrow(selectionPane, Priority.ALWAYS);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);/*from  w  w  w.j a  v  a  2 s. co  m*/
    prefix.addMenuItemFor(Prefix.FILENUMBER);

    TitledPane options = Views.titledPane(DefaultI18nContext.getInstance().i18n("Rotate settings"),
            rotateOptions);

    pane.getChildren().addAll(selectionPane, options,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane),
            prefixTitled);
    return pane;
}

From source file:org.pdfsam.alternatemix.AlternateMixModule.java

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);

    pane.getChildren().addAll(firstDocument, secondDocument,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Mix settings"), optionsPane),
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination file"), destinationPane));
    return pane;//from   w w w. j  a  v  a  2 s.c  o m
}

From source file:org.pdfsam.split.SplitModule.java

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);/* ww w  . ja va 2  s  .  c o  m*/
    prefix.addMenuItemFor(Prefix.CURRENTPAGE);
    prefix.addMenuItemFor(Prefix.FILENUMBER);

    pane.getChildren().addAll(selectionPane,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions),
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane),
            prefixTitled);
    return pane;
}

From source file:org.pdfsam.splitbybookmarks.SplitByBookmarksModule.java

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);//from w ww .j av a  2s .  c o m
    prefix.addMenuItemFor(Prefix.CURRENTPAGE);
    prefix.addMenuItemFor(Prefix.FILENUMBER);
    prefix.addMenuItemFor(Prefix.BOOKMARK);
    prefix.addMenuItemFor(Prefix.BOOKMARK_STRICT);

    pane.getChildren().addAll(selectionPane,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions),
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane),
            prefixTitled);
    return pane;
}