Example usage for javafx.scene.layout VBox VBox

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

Introduction

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

Prototype

public VBox() 

Source Link

Document

Creates a VBox layout with spacing = 0 and alignment at TOP_LEFT.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Table View Sample");
    stage.setWidth(300);//from   www  . j a  v a  2s  .co m
    stage.setHeight(500);

    final Label label = new Label("Student IDs");
    label.setFont(new Font("Arial", 20));

    TableColumn<Map, String> firstDataColumn = new TableColumn<>("Class A");
    TableColumn<Map, String> secondDataColumn = new TableColumn<>("Class B");

    firstDataColumn.setCellValueFactory(new MapValueFactory(Column1MapKey));
    firstDataColumn.setMinWidth(130);
    secondDataColumn.setCellValueFactory(new MapValueFactory(Column2MapKey));
    secondDataColumn.setMinWidth(130);

    TableView tableView = new TableView<>(generateDataInMap());

    tableView.setEditable(true);
    tableView.getSelectionModel().setCellSelectionEnabled(true);
    tableView.getColumns().setAll(firstDataColumn, secondDataColumn);
    Callback<TableColumn<Map, String>, TableCell<Map, String>> cellFactoryForMap = (
            TableColumn<Map, String> p) -> new TextFieldTableCell(new StringConverter() {
                @Override
                public String toString(Object t) {
                    return t.toString();
                }

                @Override
                public Object fromString(String string) {
                    return string;
                }
            });
    firstDataColumn.setCellFactory(cellFactoryForMap);
    secondDataColumn.setCellFactory(cellFactoryForMap);

    final VBox vbox = new VBox();

    vbox.setSpacing(5);
    vbox.setPadding(new Insets(10, 0, 0, 10));
    vbox.getChildren().addAll(label, tableView);

    ((Group) scene.getRoot()).getChildren().addAll(vbox);

    stage.setScene(scene);

    stage.show();
}

From source file:cz.lbenda.gui.tableView.FilterMenuItem.java

public FilterMenuItem(FilterableTableView filterableTableView, FilterableTableColumn filterableTableColumn) {
    this(new VBox(), filterableTableView, filterableTableColumn);
}

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

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);//from  w w  w .jav a 2s  .c o  m
    VBox.setVgrow(selectionPane, Priority.ALWAYS);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);
    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:com.scndgen.legends.windows.WindowAbout.java

public WindowAbout() {
    super(StageStyle.UNDECORATED);
    try {/*from   www. j a va 2s  . c o  m*/
        about = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtAbout.txt"),
                Charset.defaultCharset());
        licenseText = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtLicense.txt"),
                Charset.defaultCharset());
        changeLog = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtChangelog.txt"),
                Charset.defaultCharset());
        sourceCode = IOUtils.toString(
                Thread.currentThread().getContextClassLoader().getResourceAsStream("text/txtSourceCode.txt"),
                Charset.defaultCharset());
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    txtAbout = new TextArea("");
    txtAbout.setText(about);
    txtAbout.setEditable(false);
    txtAbout.setWrapText(true);
    scrlAbout = new ScrollPane(txtAbout);

    txtLicense = new TextArea("");
    txtLicense.setText(licenseText);
    txtLicense.setEditable(false);
    txtLicense.setWrapText(true);
    scrlLicense = new ScrollPane(txtLicense);

    txtChangeLog = new TextArea("");
    txtChangeLog.setText(changeLog);
    txtChangeLog.setEditable(false);
    txtChangeLog.setWrapText(true);
    scrlChangeLog = new ScrollPane(txtChangeLog);

    txtSourceCode = new TextArea("");
    txtSourceCode.setText(sourceCode);
    txtSourceCode.setEditable(false);
    txtSourceCode.setWrapText(true);
    scrlSourceCode = new ScrollPane(txtSourceCode);

    Tab tabAbout = new Tab("About");
    tabAbout.setClosable(false);
    Tab tabLicense = new Tab("License");
    tabLicense.setClosable(false);
    Tab tabDevelop = new Tab("Develop");
    tabDevelop.setClosable(false);
    Tab tabChangelog = new Tab("Changelog");
    tabChangelog.setClosable(false);

    tabAbout.setContent(scrlAbout);
    tabLicense.setContent(scrlLicense);
    tabDevelop.setContent(scrlSourceCode);
    tabChangelog.setContent(scrlChangeLog);

    tabPane = new TabPane();
    tabPane.getTabs().add(tabAbout);
    tabPane.getTabs().add(tabLicense);
    tabPane.getTabs().add(tabChangelog);
    tabPane.getTabs().add(tabDevelop);

    btnOk = new Button("OK");
    btnOk.setOnAction(event -> {
        close();
    });

    VBox vBox = new VBox();
    vBox.setSpacing(4);
    vBox.getChildren().add(tabPane);
    vBox.getChildren().add(btnOk);

    setTitle(Language.get().get(57));
    setScene(new Scene(vBox));
    setResizable(false);
    initModality(Modality.APPLICATION_MODAL);
    show();
}

From source file:dsfixgui.view.DSFHudPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);//  w ww . j  ava2s  . co  m
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(HUD.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().add("settings_title");
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //Toggle HUD Modifications
    hudModsPane = new FlowPane();
    hudModsPane.getStyleClass().add("settings_pane");
    hudModsLabel = new Label(HUD_MODS_LABEL + "  ");
    hudModsLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    hudModsLabel.setTooltip(new Tooltip(HUD_MODS_TT));
    hudModsPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableHudMod.get() == 0) {
        hudModsPicker.setValue(hudModsPicker.getItems().get(0));
    } else {
        hudModsPicker.setValue(hudModsPicker.getItems().get(1));
    }
    hudModsPane.getChildren().addAll(hudModsLabel, hudModsPicker);
    //
    //Minimal HUD
    minimalHUDPane = new FlowPane();
    minimalHUDPane.getStyleClass().add("settings_pane");
    minimalHUDLabel = new Label(MINIMAL_HUD_LABEL + "  ");
    minimalHUDLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    minimalHUDLabel.setTooltip(new Tooltip(MIN_HUD_TT));
    minimalHUDPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableMinimalHud.get() == 0) {
        minimalHUDPicker.setValue(minimalHUDPicker.getItems().get(0));
    } else {
        minimalHUDPicker.setValue(minimalHUDPicker.getItems().get(1));
    }
    minimalHUDPane.getChildren().addAll(minimalHUDLabel, minimalHUDPicker);
    //
    //HUD Scale
    hudScalePane = new FlowPane();
    hudScalePane.getStyleClass().add("settings_pane");
    hudScaleLabel = new Label(HUD_SCALE_LABEL + "  ");
    hudScaleLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    hudScaleLabel.setTooltip(new Tooltip(HUD_SCALE_TT));
    hudScaleField = new TextField(config.hudScaleFactor.toString());
    hudScaleField.getStyleClass().add("settings_med_text_field");
    hudScalePane.getChildren().addAll(hudScaleLabel, hudScaleField);
    //
    //HUD Opacities Parent Label
    hudOpacitiesPane = new FlowPane();
    hudOpacitiesPane.getStyleClass().add("settings_pane");
    hudOpacitiesLabel = new Label(HUD_OPACITIES_LABEL + "  ");
    hudOpacitiesLabel.getStyleClass().addAll("bold_text", "font_14_pt");
    hudOpacitiesLabel.setTooltip(new Tooltip(HUD_OPS_TT));
    hudOpacitiesPane.getChildren().addAll(hudOpacitiesLabel);
    //
    //Top Left HUD Opacity
    topLeftHUDOpPane = new FlowPane();
    topLeftHUDOpPane.getStyleClass().add("settings_pane");
    topLeftHUDOpLabel = new Label(TOP_LEFT_HUD_OP_LABEL + "  ");
    topLeftHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    topLeftHUDOpLabel.setTooltip(new Tooltip(TOP_LEFT_HUD_TT));
    topLeftHUDOpField = new TextField(
            config.hudTopLeftOpacity.toString().substring(0, config.hudTopLeftOpacity.length() - 1));
    topLeftHUDOpField.getStyleClass().add("settings_med_text_field");
    topLeftHUDOpPane.getChildren().addAll(topLeftHUDOpLabel, topLeftHUDOpField);
    //
    //Bottom Left HUD Opacity
    bottomLeftHUDOpPane = new FlowPane();
    bottomLeftHUDOpPane.getStyleClass().add("settings_pane");
    bottomLeftHUDOpLabel = new Label(BOTTOM_LEFT_HUD_OP_LABEL + "  ");
    bottomLeftHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    bottomLeftHUDOpLabel.setTooltip(new Tooltip(BOTTOM_LEFT_HUD_TT));
    bottomLeftHUDOpField = new TextField(
            config.hudBottomLeftOpacity.toString().substring(0, config.hudBottomLeftOpacity.length() - 1));
    bottomLeftHUDOpField.getStyleClass().add("settings_med_text_field");
    bottomLeftHUDOpPane.getChildren().addAll(bottomLeftHUDOpLabel, bottomLeftHUDOpField);
    //
    //Bottom Riht HUD Opacity
    bottomRightHUDOpPane = new FlowPane();
    bottomRightHUDOpPane.getStyleClass().add("settings_pane");
    bottomRightHUDOpLabel = new Label(BOTTOM_RIGHT_HUD_OP_LABEL + "  ");
    bottomRightHUDOpLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    bottomRightHUDOpLabel.setTooltip(new Tooltip(BOTTOM_RIGHT_HUD_TT));
    bottomRightHUDOpField = new TextField(
            config.hudBottomRightOpacity.toString().substring(0, config.hudBottomRightOpacity.length() - 1));
    bottomRightHUDOpField.getStyleClass().add("settings_med_text_field");
    bottomRightHUDOpPane.getChildren().addAll(bottomRightHUDOpLabel, bottomRightHUDOpField);

    if (config.enableHudMod.get() == 0) {
        minimalHUDPicker.setDisable(true);
        hudScaleField.setDisable(true);
        topLeftHUDOpField.setDisable(true);
        bottomLeftHUDOpField.setDisable(true);
        bottomRightHUDOpField.setDisable(true);
    }

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, hudModsPane, minimalHUDPane,
            hudScalePane, hudOpacitiesPane, topLeftHUDOpPane, bottomLeftHUDOpPane, bottomRightHUDOpPane,
            bottomSpacerHBox);

    initializeEventHandlers();

    this.setContent(primaryPane);
}

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

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);//from  ww w .j a v a  2  s . co m

    pane.getChildren().addAll(firstDocument, secondDocument,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Mix settings"), optionsPane),
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination file"), destinationPane));
    return pane;
}

From source file:se.trixon.mapollage.ui.config.FoldersTab.java

private void createUI() {
    VBox leftBox = new VBox();
    VBox rightBox = new VBox();

    setContent(leftBox);/*  www .  ja  v a 2s .c o  m*/

    //Left Pane
    Label rootNameLabel = new Label(mBundle.getString("FoldersTab.rootNameLabel"));
    Label rootDescLabel = new Label(mBundle.getString("FoldersTab.rootDescriptionLabel"));
    Label regexLabel = new Label(Dict.DEFAULT_VALUE.toString());

    leftBox.getChildren().addAll(rootNameLabel, mRootNameTextField, rootDescLabel, mRootDescTextArea, rightBox);

    VBox.setVgrow(mRootDescTextArea, Priority.ALWAYS);

    //Right Pane
    mFolderByDirectoryRadioButton.setToggleGroup(mToggleGroup);
    mFolderByDateRadioButton.setToggleGroup(mToggleGroup);
    mFolderByRegexRadioButton.setToggleGroup(mToggleGroup);
    mFolderByNoneRadioButton.setToggleGroup(mToggleGroup);

    mDatePatternComboBox.setMaxWidth(Double.MAX_VALUE);
    mDatePatternComboBox.setEditable(true);
    mDatePatternComboBox
            .setItems(FXCollections.observableList(Arrays.asList(mBundle.getString("dateFormats").split(";"))));

    Label label = new Label(mBundle.getString("FoldersTab.folderByLabel"));
    rightBox.getChildren().addAll(label, mFolderByDirectoryRadioButton, mFolderByDateRadioButton,
            mDatePatternComboBox, mFolderByRegexRadioButton, mRegexTextField, regexLabel,
            mRegexDefaultTextField, mFolderByNoneRadioButton);

    addTopPadding(rootDescLabel, mFolderByDirectoryRadioButton, mFolderByDateRadioButton,
            mFolderByRegexRadioButton, regexLabel, mFolderByNoneRadioButton, rightBox);

    Insets leftInsets = new Insets(0, 0, 0, 24);
    VBox.setMargin(mDatePatternComboBox, leftInsets);
    VBox.setMargin(mRegexTextField, leftInsets);
    VBox.setMargin(mRegexDefaultTextField, leftInsets);
    VBox.setMargin(regexLabel, leftInsets);

    mDatePatternComboBox.disableProperty().bind(mFolderByDateRadioButton.selectedProperty().not());
    mRegexTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not());
    mRegexDefaultTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not());

    //        EventHandler eventHandler = (EventHandler) (Event event) -> {
    ////            sValidationSupport.initInitialDecoration();
    //            sValidationSupport.getValidationDecorator().removeDecorations(mDatePatternComboBox);
    //
    //            sValidationSupport.redecorate();
    //            System.out.println(event);
    //        };
    //
    //        mFolderByDateRadioButton.setOnAction(eventHandler);
    //        mFolderByDirectoryRadioButton.setOnAction(eventHandler);
    //        mFolderByNoneRadioButton.setOnAction(eventHandler);
    //        mFolderByRegexRadioButton.setOnAction(eventHandler);
}

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

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);/*from  w  ww  .  j  ava  2 s. c  o  m*/

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);
    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:Main.java

private VBox addVBox() {

    VBox vbox = new VBox();
    vbox.setPadding(new Insets(10)); // Set all sides to 10
    vbox.setSpacing(8); // Gap between nodes

    Text title = new Text("Data");
    title.setFont(Font.font("Arial", FontWeight.BOLD, 14));
    vbox.getChildren().add(title);//from  w  ww  .  jav  a 2s  . c  o m

    Hyperlink options[] = new Hyperlink[] { new Hyperlink("Sales"), new Hyperlink("Marketing"),
            new Hyperlink("Distribution"), new Hyperlink("Costs") };

    for (int i = 0; i < 4; i++) {
        // Add offset to left side to indent from title
        VBox.setMargin(options[i], new Insets(0, 0, 0, 8));
        vbox.getChildren().add(options[i]);
    }

    return vbox;
}

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

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);/*from   w  w  w  . ja  v a 2 s  . c  o  m*/

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);
    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;
}