List of usage examples for javafx.scene.layout VBox VBox
public VBox()
From source file:dsfixgui.view.DSFSavesPane.java
private void initialize() { //Basic layout this.setFitToWidth(true); spacerColumn = new ColumnConstraints(); spacerColumn.setFillWidth(true);//from w ww . j av a 2 s .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(SAVE_BACKUP.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 Save Backups saveBackupsPane = new FlowPane(); saveBackupsPane.getStyleClass().add("settings_pane"); saveBackupsLabel = new Label(SAVE_BACKUPS_LABEL + " "); saveBackupsLabel.getStyleClass().addAll("bold_text", "font_12_pt"); saveBackupsPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE)); if (config.enableBackups.get() == 0) { saveBackupsPicker.setValue(saveBackupsPicker.getItems().get(0)); } else { saveBackupsPicker.setValue(saveBackupsPicker.getItems().get(1)); } saveBackupsPane.getChildren().addAll(saveBackupsLabel, saveBackupsPicker); // //Save Backup Interval saveIntervalPane = new FlowPane(); saveIntervalPane.getStyleClass().add("settings_pane"); saveIntervalLabel = new Label(SAVE_BACKUPS_INTERVAL_LABEL + " "); saveIntervalLabel.getStyleClass().addAll("bold_text", "font_12_pt"); saveIntervalLabel.setTooltip(new Tooltip(SAVE_INTERVAL_TT)); saveIntervalField = new TextField("" + config.backupInterval.get()); saveIntervalField.getStyleClass().add("settings_text_field"); saveIntervalPane.getChildren().addAll(saveIntervalLabel, saveIntervalField); // //Max Save Backups maxSavesPane = new FlowPane(); maxSavesPane.getStyleClass().add("settings_pane"); maxSavesLabel = new Label(MAX_BACKUPS_LABEL + " "); maxSavesLabel.getStyleClass().addAll("bold_text", "font_12_pt"); maxSavesField = new TextField("" + config.maxBackups.get()); maxSavesField.getStyleClass().add("settings_text_field"); maxSavesPane.getChildren().addAll(maxSavesLabel, maxSavesField); if (config.enableBackups.get() == 0) { saveIntervalField.setDisable(true); maxSavesField.setDisable(true); } primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, saveBackupsPane, saveIntervalPane, maxSavesPane, bottomSpacerHBox); initializeEventHandlers(); this.setContent(primaryPane); }
From source file:Main.java
@Override public void start(Stage stage) { rootNode.setExpanded(true);// w w w . ja v a 2 s. c om for (Employee employee : employees) { TreeItem<String> empLeaf = new TreeItem<>(employee.getName()); boolean found = false; for (TreeItem<String> depNode : rootNode.getChildren()) { if (depNode.getValue().contentEquals(employee.getDepartment())) { depNode.getChildren().add(empLeaf); found = true; break; } } if (!found) { TreeItem depNode = new TreeItem(employee.getDepartment()); rootNode.getChildren().add(depNode); depNode.getChildren().add(empLeaf); } } stage.setTitle("Tree View Sample"); VBox box = new VBox(); final Scene scene = new Scene(box, 400, 300); scene.setFill(Color.LIGHTGRAY); TreeView<String> treeView = new TreeView<>(rootNode); treeView.setEditable(true); treeView.setCellFactory((TreeView<String> p) -> new TextFieldTreeCellImpl()); box.getChildren().add(treeView); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { rootNode.setExpanded(true);//from w ww .ja v a2 s. c om for (Employee employee : employees) { TreeItem<String> empLeaf = new TreeItem<>(employee.getName()); boolean found = false; for (TreeItem<String> depNode : rootNode.getChildren()) { if (depNode.getValue().contentEquals(employee.getDepartment())) { depNode.getChildren().add(empLeaf); found = true; break; } } if (!found) { TreeItem<String> depNode = new TreeItem<>(employee.getDepartment()); rootNode.getChildren().add(depNode); depNode.getChildren().add(empLeaf); } } stage.setTitle("Tree View Sample"); VBox box = new VBox(); final Scene scene = new Scene(box, 400, 300); scene.setFill(Color.LIGHTGRAY); TreeView<String> treeView = new TreeView<>(rootNode); treeView.setEditable(true); treeView.setCellFactory((TreeView<String> p) -> new TextFieldTreeCellImpl()); box.getChildren().add(treeView); stage.setScene(scene); stage.show(); }
From source file:de.pixida.logtest.designer.MainWindow.java
private void initWindow() { final VBox top = new VBox(); top.getChildren().addAll(this.createMenuBar()); this.root.setTop(top); this.bindEditorDependentProperties(); this.tabPane.getSelectionModel().selectedItemProperty().addListener((ov, oldTab, newTab) -> { this.bindEditorDependentProperties(); });/*from w w w . j av a 2s .c o m*/ this.root.setCenter(this.tabPane); this.primaryStage.getIcons().add(Icons.getIconImage(APP_ICON)); final Scene rootScene = new Scene(this.root, 800, 600); this.initDragAndDropForRootScene(rootScene); this.primaryStage.setScene(rootScene); this.primaryStage.setOnCloseRequest(event -> { if (!this.handleExitApplication()) { event.consume(); // Prevent window from closing } }); this.primaryStage.show(); }
From source file:mesclasses.view.TimetableController.java
private VBox createEvent(Cours theCours) { VBox event = new VBox(); CssUtil.addClass(event, "event"); CssUtil.addClass(event, getCSS(theCours)); String periodicite = theCours.getWeek().equals(config.getProperty(Constants.CONF_WEEK_DEFAULT)) ? "" : theCours.getWeek();//from w w w . j a va 2 s.c o m String salle = StringUtils.isNotBlank(theCours.getRoom()) ? "salle " + theCours.getRoom() : ""; Label periodiciteAndSalle = new Label((periodicite + " " + salle).trim()); bindWidth(periodiciteAndSalle, event, 1); Label classe = new Label(theCours.getClasse().getName()); CssUtil.addClass(classe, "event-classe"); bindWidth(classe, event, 1); //horaires HBox horaires = new HBox(); CssUtil.addClass(horaires, "horaires"); Label start = new Label(" " + NodeUtil.getStartTime(theCours)); CssUtil.addClass(start, "start"); Label end = new Label(NodeUtil.getEndTime(theCours) + " "); CssUtil.addClass(end, "end"); horaires.getChildren().add(start); horaires.getChildren().add(end); bindWidth(horaires, event, 1); bindWidth(start, horaires, 2); bindWidth(end, horaires, 2); event.getChildren().add(periodiciteAndSalle); bindHeight(periodiciteAndSalle, event, 3); event.getChildren().add(classe); bindHeight(classe, event, 3); event.getChildren().add(horaires); bindHeight(horaires, event, 3); event.setOnMouseReleased((e) -> { handleEditCours(theCours); }); theCours.setEvent(event); return event; }
From source file:dsfixgui.view.DSFUnsafeSettingsPane.java
private void initialize() { //Basic layout this.setFitToWidth(true); spacerColumn = new ColumnConstraints(); spacerColumn.setFillWidth(true);/*from www .j ava 2 s .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(UNSAFE_OPS.toUpperCase() + " " + SETTINGS.toUpperCase()); titleLabel.getStyleClass().addAll("settings_title", "red_text"); titleLabel.setTooltip(new Tooltip(UNSAFE_TT)); 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///////////////////// // // //Force Window Modes windowModePane = new FlowPane(); windowModePane.getStyleClass().add("settings_pane"); windowModeLabel = new Label(FORCE_WINDOW_MODE_LABEL + " "); windowModeLabel.getStyleClass().addAll("bold_text", "font_12_pt"); windowModeChoice = new ToggleGroup(); neitherWindowMode = new RadioButton(WINDOW_MODES[0] + " "); neitherWindowMode.setToggleGroup(windowModeChoice); forceWindowed = new RadioButton(WINDOW_MODES[1]); forceWindowed.setToggleGroup(windowModeChoice); forceFullscreen = new RadioButton(WINDOW_MODES[2]); forceFullscreen.setToggleGroup(windowModeChoice); if (config.forceWindowed.get() == 0 && config.forceFullscreen.get() == 0) { neitherWindowMode.setSelected(true); } else if (config.forceWindowed.get() == 1) { forceWindowed.setSelected(true); config.forceFullscreen.set(0); } else { forceFullscreen.setSelected(true); } windowModePane.getChildren().addAll(windowModeLabel, neitherWindowMode, forceWindowed, forceFullscreen); // //Toggle Vsync vsyncPane = new FlowPane(); vsyncPane.getStyleClass().add("settings_pane"); vsyncLabel = new Label(VSYNC_LABEL + " "); vsyncLabel.getStyleClass().addAll("bold_text", "font_12_pt"); vsyncLabel.setTooltip(new Tooltip(VSYNC_TT)); vsyncPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE)); if (config.enableVsync.get() == 0) { vsyncPicker.setValue(vsyncPicker.getItems().get(0)); } else { vsyncPicker.setValue(vsyncPicker.getItems().get(1)); } vsyncPane.getChildren().addAll(vsyncLabel, vsyncPicker); // //Fullscreen Refresh Rate refreshRatePane = new FlowPane(); refreshRatePane.getStyleClass().add("settings_pane"); refreshRateLabel = new Label(REFRESH_RATE_LABEL + " "); refreshRateLabel.getStyleClass().addAll("bold_text", "font_12_pt"); refreshRateLabel.setTooltip(new Tooltip(FULLSCREEN_HZ_TT)); refreshRateField = new TextField("" + config.fullscreenHz.get()); refreshRateField.getStyleClass().add("settings_text_field"); refreshRatePane.getChildren().addAll(refreshRateLabel, refreshRateField); // primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, windowModePane, vsyncPane, refreshRatePane, bottomSpacerHBox); initializeEventHandlers(); this.setContent(primaryPane); }
From source file:Main.java
@Override public void start(Stage stage) { Callback<TableColumn<Person, String>, TableCell<Person, String>> cellFactory = ( TableColumn<Person, String> p) -> new EditingCell(); Scene scene = new Scene(new Group()); stage.setWidth(450);/* ww w. ja v a 2 s . c o m*/ stage.setHeight(550); table.setEditable(true); TableColumn<Person, String> firstNameCol = new TableColumn<>("First Name"); firstNameCol.setMinWidth(100); firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); firstNameCol.setCellFactory(cellFactory); firstNameCol.setOnEditCommit((CellEditEvent<Person, String> t) -> { ((Person) t.getTableView().getItems().get(t.getTablePosition().getRow())).setFirstName(t.getNewValue()); }); TableColumn<Person, String> lastNameCol = new TableColumn<>("Last Name"); lastNameCol.setMinWidth(100); lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(table); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("java-buddy.blogspot.com"); tableView.setEditable(true);/*www.java2s . c om*/ Callback<TableColumn, TableCell> cellFactory = new Callback<TableColumn, TableCell>() { @Override public TableCell call(TableColumn p) { return new EditingCell(); } }; btnNew.setOnAction(btnNewHandler); //init table //Un-editable column of "id" TableColumn col_id = new TableColumn("ID"); tableView.getColumns().add(col_id); col_id.setCellValueFactory(new PropertyValueFactory<Record, String>("id")); //Editable columns for (int i = 0; i < Day.length; i++) { TableColumn col = new TableColumn(Day[i]); col.setCellValueFactory(new PropertyValueFactory<Record, String>("value_" + String.valueOf(i))); tableView.getColumns().add(col); col.setCellFactory(cellFactory); } tableView.setItems(data); Group root = new Group(); VBox vBox = new VBox(); vBox.setSpacing(10); vBox.getChildren().addAll(btnNew, tableView); root.getChildren().add(vBox); primaryStage.setScene(new Scene(root, 500, 400)); primaryStage.show(); }
From source file:org.pdfsam.merge.MergeModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER);/* w ww. j av a 2s .c o m*/ 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 source file:gov.va.isaac.sync.view.SyncView.java
private void initGui() { root_ = new BorderPane(); root_.setPrefWidth(550);// w w w .j a v a2s. c om VBox titleBox = new VBox(); Label title = new Label("Datastore Synchronization"); title.getStyleClass().add("titleLabel"); title.setAlignment(Pos.CENTER); title.setMaxWidth(Double.MAX_VALUE); title.setPadding(new Insets(10)); titleBox.getChildren().add(title); titleBox.getStyleClass().add("headerBackground"); url_ = AppContext.getAppConfiguration().getCurrentChangeSetUrl(); String urlType = AppContext.getAppConfiguration().getChangeSetUrlTypeName(); String syncUsername = ExtendedAppContext.getCurrentlyLoggedInUserProfile().getSyncUsername(); if (StringUtils.isBlank(syncUsername)) { syncUsername = ExtendedAppContext.getCurrentlyLoggedInUser(); } url_ = syncService_.substituteURL(url_, syncUsername); Label info = new CopyableLabel("Sync using " + urlType + ": " + url_); info.setTooltip(new Tooltip(url_)); titleBox.getChildren().add(info); titleBox.setPadding(new Insets(5, 5, 5, 5)); root_.setTop(titleBox); VBox centerContent = new VBox(); centerContent.setFillWidth(true); centerContent.setPrefWidth(Double.MAX_VALUE); centerContent.setPadding(new Insets(10)); centerContent.getStyleClass().add("itemBorder"); centerContent.setSpacing(10.0); centerContent.getChildren().add(new Label("Status:")); summary_ = new TextArea(); summary_.setWrapText(true); summary_.setEditable(false); summary_.setMaxWidth(Double.MAX_VALUE); summary_.setMaxHeight(Double.MAX_VALUE); summary_.setPrefHeight(150.0); centerContent.getChildren().add(summary_); VBox.setVgrow(summary_, Priority.ALWAYS); pb_ = new ProgressBar(0.0); pb_.setPrefHeight(20); pb_.setMaxWidth(Double.MAX_VALUE); centerContent.getChildren().add(pb_); root_.setCenter(centerContent); //Bottom buttons HBox buttons = new HBox(); buttons.setMaxWidth(Double.MAX_VALUE); buttons.setAlignment(Pos.CENTER); buttons.setPadding(new Insets(5)); buttons.setSpacing(30); Button cancel = new Button("Close"); cancel.setOnAction((action) -> { if (running_.get()) { addLine("Cancelling..."); cancel.setDisable(true); cancelRequested_ = true; } else { cancel.getScene().getWindow().hide(); root_ = null; } }); buttons.getChildren().add(cancel); Button action = new Button("Synchronize"); action.disableProperty().bind(running_); action.setOnAction((theAction) -> { summary_.setText(""); pb_.setProgress(-1.0); running_.set(true); Utility.execute(() -> sync()); }); buttons.getChildren().add(action); cancel.minWidthProperty().bind(action.widthProperty()); running_.addListener(change -> { if (running_.get()) { cancel.setText("Cancel"); } else { cancel.setText("Close"); } cancel.setDisable(false); }); root_.setBottom(buttons); }