@Override public void start(Stage primaryStage) throws Exception { JFXComboBox<Label> combo = new JFXComboBox<>(); combo.getItems().add(new Label("Java 1.8")); combo.getItems().add(new Label("Java 1.7")); combo.getItems().add(new Label("Java 1.6")); combo.getItems().add(new Label("Java 1.5")); combo.setEditable(true); combo.setPromptText("Select Java Version"); combo.setConverter(new StringConverter<Label>() { @Override public String toString(Label object) { return object==null? "" : object.getText(); } @Override public Label fromString(String string) { return new Label(string); } }); HBox pane = new HBox(100); HBox.setMargin(combo, new Insets(20)); pane.setStyle("-fx-background-color:WHITE"); pane.getChildren().add(combo); final Scene scene = new Scene(pane, 300, 300); scene.getStylesheets().add(ComboBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.setTitle("JFX ComboBox Demo"); primaryStage.setScene(scene); primaryStage.setResizable(false); primaryStage.show(); }
graphicTextContainer.setPickOnBounds(false); HBox.setHgrow(graphicTextContainer, Priority.ALWAYS); HBox.setMargin(graphicContainer, new Insets(0, 8 , 0, 8));
public ExpandButton() { getStyleClass().add("quickbar-expand-button"); toggle.getStyleClass().addAll("pdfsam-toolbar-button", "quickbar-expand-toggle"); expand.setContent("M0,-5L5,0L0,5Z"); expand.getStyleClass().add("quickbar-button-arrow"); collapse.setContent("M0,-5L-5,0L0,5Z"); collapse.getStyleClass().add("quickbar-button-arrow"); toggle.setGraphic(expand); toggle.selectedProperty().addListener((observable, oldValue, newValue) -> { if (newValue) { toggle.setGraphic(collapse); } else { toggle.setGraphic(expand); } }); HBox.setMargin(toggle, new Insets(0, 7, 0, 7)); getChildren().add(toggle); }
public SingleSelectionPane(String ownerModule) { this.getStyleClass().add("single-selection-pane"); this.ownerModule = defaultString(ownerModule); this.details.getStyleClass().add("-pdfsam-selection-details"); field.enforceValidation(true, false); passwordPopup = new PasswordFieldPopup(this.ownerModule); encryptionIndicator.getStyleClass().addAll("encryption-status"); encryptionIndicator.addEventFilter(MouseEvent.MOUSE_CLICKED, e -> { if (descriptor.loadingStatus().getValue() == ENCRYPTED) { showPasswordFieldPopup(); } else if (descriptor.loadingStatus().getValue() == WITH_ERRORS) { eventStudio().broadcast(ShowStageRequest.INSTANCE, "LogStage"); } }); HBox.setMargin(encryptionIndicator, new Insets(0, 0, 0, 2)); field.setGraphic(encryptionIndicator); field.getStyleClass().add("single-selection-top"); HBox.setHgrow(field, Priority.ALWAYS); getChildren().addAll(field, details); field.getTextField().validProperty().addListener(onValidState); initContextMenu(); eventStudio().addAnnotatedListeners(this); }
HBox pane = new HBox(); Button buttonOK = new Button("OK"); Button buttonCancel = new Button("Cancel"); /************************************************/ pane.setMargin(buttonOK, new Insets(0, 10, 0, 0)); //This is where you should be looking at. /************************************************/ pane.setPadding(new Insets(25)); pane.getChildren().addAll(buttonOK, buttonCancel); Scene scene = new Scene(pane); primaryStage.setTitle("Stage Title"); primaryStage.setScene(scene); primaryStage.show();
/** * * @param node */ protected void apply(Node node) { // sanatize the node super.apply(node); // apply constraints if (hgrow != null) GenericLayoutConstraints.overrideMaxWidth(node, this); javafx.scene.layout.HBox.setHgrow(node, hgrow != null ? hgrow : hgrowReset); javafx.scene.layout.HBox.setMargin(node, margin != null ? margin : marginReset); } }
@Override // This method is called by the FXMLLoader when initialization is complete public void initialize(URL fxmlFileLocation, ResourceBundle resources) { assert pane != null : "fx:id=\"pane\" was not injected: check your FXML file 'Hotfix.fxml'."; assert restartAll != null : "fx:id=\"restartAll\" was not injected: check your FXML file 'Hotfix.fxml'."; restartAll.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { copperDataProvider.restartAllError(hotfixModelModel.selectedEngine.get().getId()); } }); Node engineSelectionWidget = new EngineSelectionWidget(hotfixModelModel, copperDataProvider.getEngineList()).createContent(); HBox.setMargin(engineSelectionWidget, new Insets(3)); pane.getChildren().add(engineSelectionWidget); }
Node tableControlWidgetContent = tableControlWidget.createContent(); HBox.setHgrow(tableControlWidgetContent, Priority.ALWAYS); HBox.setMargin(tableControlWidgetContent, new Insets(0,1,0,0));
HBox.setMargin(refreshButton, new Insets(4, 0, 4, 0)); refreshButton.setTooltip(new Tooltip(messageProvider.getText(MessageKey.filterAbleForm_button_refresh))); refreshButton.setOnAction(new EventHandler<ActionEvent>() {
Node tableControlWidgetContent = tableControlWidget.createContent(); HBox.setHgrow(tableControlWidgetContent, Priority.ALWAYS); HBox.setMargin(tableControlWidgetContent, new Insets(0,1,0,0));
HBox.setMargin(b, new Insets(0, 1, 0, 0)); } else if (this.box instanceof VBox) { VBox.setMargin(b, new Insets(1, 0, 0, 0));
@Override public Node createContent() { SplitPane splitPane = new SplitPane(); splitPane.setOrientation(orientation); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); column = new TableColumn<>("Data"); column.setCellValueFactory(param -> new DataObservableDisplayText(param.getValue()).get()); tableView.getColumns().add(column); BorderPane borderPaneWrapper = new BorderPane(); borderPaneWrapper.setCenter(tableView); SplitPane.setResizableWithParent(borderPaneWrapper, Boolean.FALSE); splitPane.getItems().add(borderPaneWrapper); Node dataEditorWidget = this.dataEditor.createContent(); SplitPane.setResizableWithParent(dataEditorWidget, Boolean.TRUE); splitPane.getItems().add(dataEditorWidget); splitPane.setDividerPositions(dividerPosition); tableView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { dataEditor.edit(newValue); }); listEditWidget = new BorderPane(); TableControlWidget tableControlWidget= new TableControlWidget<>(tableView, uniformDesign); Node tableControlWidgetContent = tableControlWidget.createContent(); HBox hBox = new HBox(); hBox.getChildren().addAll(listEditWidget, tableControlWidgetContent); HBox.setHgrow(tableControlWidgetContent, Priority.ALWAYS); HBox.setMargin(tableControlWidgetContent, new Insets(0,1,0,0)); borderPaneWrapper.setBottom(hBox); tableView.setTableMenuButtonVisible(false); return splitPane; }
graphicTextContainer.setPickOnBounds(false); HBox.setHgrow(graphicTextContainer, Priority.ALWAYS); HBox.setMargin(graphicContainer, new Insets(0, 8 , 0, 8));
Node tableControlWidgetContent = tableControlWidget.createContent(); HBox.setHgrow(tableControlWidgetContent,Priority.ALWAYS); HBox.setMargin(tableControlWidgetContent, new Insets(0,1,0,0)); listControls.getChildren().add(tableControlWidgetContent);
/** * {@inheritDoc} */ @Override protected void initView() { super.initView(); node().setStyle("-fx-background-color:white"); node().setPadding(new Insets(10, 20, 10, 20)); node().setSpacing(40); node().setAlignment(Pos.CENTER); this.summary = new Label("0 item left"); HBox.setMargin(this.summary, new Insets(10, 80, 10, 10)); this.group = new ToggleGroup(); this.all = new ToggleButton("All"); this.all.setUserData(FilterKind.All); this.all.setToggleGroup(this.group); this.active = new ToggleButton("Active"); this.active.setUserData(FilterKind.Undone); this.active.setToggleGroup(this.group); this.completed = new ToggleButton("Done"); this.completed.setUserData(FilterKind.Done); this.completed.setToggleGroup(this.group); this.all.setSelected(true); node().getChildren().addAll(this.summary, this.all, this.active, this.completed); }