List of usage examples for javafx.geometry HPos RIGHT
HPos RIGHT
To view the source code for javafx.geometry HPos RIGHT.
Click Source Link
From source file:Main.java
private GridPane createGridPane() { GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(5);//w ww . j av a2 s . com gridpane.setVgap(5); ColumnConstraints column1 = new ColumnConstraints(100); ColumnConstraints column2 = new ColumnConstraints(50, 150, 300); column2.setHgrow(Priority.ALWAYS); gridpane.getColumnConstraints().addAll(column1, column2); Label fNameLbl = new Label("First Name"); TextField fNameFld = new TextField(); Label lNameLbl = new Label("Last Name"); TextField lNameFld = new TextField(); Button saveButton = new Button("Save"); GridPane.setHalignment(fNameLbl, HPos.RIGHT); GridPane.setHalignment(lNameLbl, HPos.RIGHT); GridPane.setHalignment(fNameFld, HPos.LEFT); GridPane.setHalignment(lNameFld, HPos.LEFT); GridPane.setHalignment(saveButton, HPos.RIGHT); gridpane.add(fNameLbl, 0, 0); gridpane.add(fNameFld, 1, 0); gridpane.add(lNameLbl, 0, 1); gridpane.add(lNameFld, 1, 1); gridpane.add(saveButton, 1, 2); return gridpane; }
From source file:Main.java
public MyDialog(Stage owner) { super();//w ww.j a va 2 s .c om initOwner(owner); setTitle("title"); Group root = new Group(); Scene scene = new Scene(root, 250, 150, Color.WHITE); setScene(scene); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(5); gridpane.setVgap(5); Label userNameLbl = new Label("User Name: "); gridpane.add(userNameLbl, 0, 1); Label passwordLbl = new Label("Password: "); gridpane.add(passwordLbl, 0, 2); final TextField userNameFld = new TextField("Admin"); gridpane.add(userNameFld, 1, 1); final PasswordField passwordFld = new PasswordField(); passwordFld.setText("password"); gridpane.add(passwordFld, 1, 2); Button login = new Button("Change"); login.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { close(); } }); gridpane.add(login, 1, 3); GridPane.setHalignment(login, HPos.RIGHT); root.getChildren().add(gridpane); }
From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java
private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList, List<Country> dataProvider) { Label label = addLabel(gridPane, ++gridRow, title, 0); label.setWrapText(true);/*from w w w .j a va 2s . c om*/ label.setMaxWidth(180); label.setTextAlignment(TextAlignment.RIGHT); GridPane.setHalignment(label, HPos.RIGHT); GridPane.setValignment(label, VPos.TOP); FlowPane flowPane = new FlowPane(); flowPane.setPadding(new Insets(10, 10, 10, 10)); flowPane.setVgap(10); flowPane.setHgap(10); flowPane.setMinHeight(55); if (isEditable) flowPane.setId("flow-pane-checkboxes-bg"); else flowPane.setId("flow-pane-checkboxes-non-editable-bg"); dataProvider.stream().forEach(country -> { final String countryCode = country.code; CheckBox checkBox = new CheckBox(countryCode); checkBox.setUserData(countryCode); checkBoxList.add(checkBox); checkBox.setMouseTransparent(!isEditable); checkBox.setMinWidth(45); checkBox.setMaxWidth(45); checkBox.setTooltip(new Tooltip(country.name)); checkBox.setOnAction(event -> { if (checkBox.isSelected()) sepaAccount.addAcceptedCountry(countryCode); else sepaAccount.removeAcceptedCountry(countryCode); updateAllInputsValid(); }); flowPane.getChildren().add(checkBox); }); updateCountriesSelection(isEditable, checkBoxList); GridPane.setRowIndex(flowPane, gridRow); GridPane.setColumnIndex(flowPane, 1); gridPane.getChildren().add(flowPane); }
From source file:AudioPlayer3.java
@Override protected Node initView() { final Button openButton = createOpenButton(); controlPanel = createControlPanel(); volumeSlider = createSlider("volumeSlider"); statusLabel = createLabel("Buffering", "statusDisplay"); positionSlider = createSlider("positionSlider"); totalDurationLabel = createLabel("00:00", "mediaText"); currentTimeLabel = createLabel("00:00", "mediaText"); positionSlider.valueChangingProperty().addListener(new PositionListener()); final ImageView volLow = new ImageView(); volLow.setId("volumeLow"); final ImageView volHigh = new ImageView(); volHigh.setId("volumeHigh"); final GridPane gp = new GridPane(); gp.setHgap(1);/*from ww w . ja v a 2 s . c o m*/ gp.setVgap(1); gp.setPadding(new Insets(10)); final ColumnConstraints buttonCol = new ColumnConstraints(100); final ColumnConstraints spacerCol = new ColumnConstraints(40, 80, 80); final ColumnConstraints middleCol = new ColumnConstraints(); middleCol.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().addAll(buttonCol, spacerCol, middleCol, spacerCol, buttonCol); GridPane.setValignment(openButton, VPos.BOTTOM); GridPane.setHalignment(volHigh, HPos.RIGHT); GridPane.setValignment(volumeSlider, VPos.TOP); GridPane.setHalignment(statusLabel, HPos.RIGHT); GridPane.setValignment(statusLabel, VPos.TOP); GridPane.setHalignment(currentTimeLabel, HPos.RIGHT); gp.add(openButton, 0, 0, 1, 3); gp.add(volLow, 1, 0); gp.add(volHigh, 1, 0); gp.add(volumeSlider, 1, 1); gp.add(controlPanel, 2, 0, 1, 2); gp.add(statusLabel, 3, 1); gp.add(currentTimeLabel, 1, 2); gp.add(positionSlider, 2, 2); gp.add(totalDurationLabel, 3, 2); return gp; }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
protected void createGridPane() { gridPane = new GridPane(); gridPane.setHgap(5);/*from w w w. j a v a 2 s. com*/ gridPane.setVgap(5); gridPane.setPadding(new Insets(30, 30, 30, 30)); gridPane.setPrefWidth(width); ColumnConstraints columnConstraints1 = new ColumnConstraints(); columnConstraints1.setHalignment(HPos.RIGHT); columnConstraints1.setHgrow(Priority.SOMETIMES); ColumnConstraints columnConstraints2 = new ColumnConstraints(); columnConstraints2.setHgrow(Priority.ALWAYS); gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2); }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddSememePopup.java
private AddSememePopup() { super();/*from ww w . ja v a 2 s. co m*/ BorderPane root = new BorderPane(); VBox topItems = new VBox(); topItems.setFillWidth(true); title_ = new Label("Create new sememe instance"); title_.getStyleClass().add("titleLabel"); title_.setAlignment(Pos.CENTER); title_.prefWidthProperty().bind(topItems.widthProperty()); topItems.getChildren().add(title_); VBox.setMargin(title_, new Insets(10, 10, 10, 10)); gp_ = new GridPane(); gp_.setHgap(10.0); gp_.setVgap(10.0); VBox.setMargin(gp_, new Insets(5, 5, 5, 5)); topItems.getChildren().add(gp_); Label referencedComponent = new Label("Referenced Component"); referencedComponent.getStyleClass().add("boldLabel"); gp_.add(referencedComponent, 0, 0); unselectableComponentLabel_ = new CopyableLabel(); unselectableComponentLabel_.setWrapText(true); AppContext.getService(DragRegistry.class).setupDragOnly(unselectableComponentLabel_, () -> { if (editRefex_ == null) { return focusNid_ + ""; } else { return Get.identifierService().getConceptNid(editRefex_.getSememe().getAssemblageSequence()) + ""; } }); //delay adding till we know which row Label assemblageConceptLabel = new Label("Assemblage Concept"); assemblageConceptLabel.getStyleClass().add("boldLabel"); gp_.add(assemblageConceptLabel, 0, 1); selectableConcept_ = new ConceptNode(null, true, refexDropDownOptions, null); selectableConcept_.getConceptProperty().addListener(new ChangeListener<ConceptSnapshot>() { @Override public void changed(ObservableValue<? extends ConceptSnapshot> observable, ConceptSnapshot oldValue, ConceptSnapshot newValue) { if (createRefexFocus_ != null && createRefexFocus_ == ViewFocus.REFERENCED_COMPONENT) { if (selectableConcept_.isValid().get()) { //Its a valid concept, but is it a valid assemblage concept? try { assemblageInfo_ = DynamicSememeUsageDescription .read(selectableConcept_.getConceptNoWait().getNid()); assemblageIsValid_.set(true); if (assemblageInfo_.getReferencedComponentTypeRestriction() != null) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeNid(focusNid_), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //don't need coordinates for component type validator if (result.length() > 0) { selectableConcept_.isValid() .setInvalid("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction() .toString() + ", which doesn't match the referenced component."); logger_.info("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction().toString() + ", which doesn't match the referenced component."); assemblageIsValid_.set(false); } } } catch (Exception e) { selectableConcept_.isValid().setInvalid( "The selected concept is not properly constructed for use as an Assemblage concept"); logger_.info("Concept not a valid concept for a sememe assemblage", e); assemblageIsValid_.set(false); } } else { assemblageInfo_ = null; assemblageIsValid_.set(false); } buildDataFields(assemblageIsValid_.get(), null); } } }); selectableComponent_ = new TextField(); selectableComponentNodeValid_ = new ValidBooleanBinding() { { setComputeOnInvalidate(true); bind(selectableComponent_.textProperty()); invalidate(); } @Override protected boolean computeValue() { if (createRefexFocus_ != null && createRefexFocus_ == ViewFocus.ASSEMBLAGE && !conceptNodeIsConceptType_) { //If the assembly nid was what was set - the component node may vary - validate if we are using the text field String value = selectableComponent_.getText().trim(); if (value.length() > 0) { try { if (Utility.isUUID(value)) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeUUID(UUID.fromString(value)), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else if (Utility.isInt(value)) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeNid(Integer.parseInt(value)), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else { setInvalidReason( "Value cannot be parsed as a component identifier. Must be a UUID or a valid NID"); return false; } } catch (Exception e) { logger_.error("Error checking component type validation", e); setInvalidReason("Unexpected error validating entry"); return false; } } else { setInvalidReason("Component identifier is required"); return false; } } clearInvalidReason(); return true; } }; selectableComponentNode_ = ErrorMarkerUtils.setupErrorMarker(selectableComponent_, null, selectableComponentNodeValid_); //delay adding concept / component till we know if / where ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); cc.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(referencedComponent)); gp_.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp_.getColumnConstraints().add(cc); Label l = new Label("Data Fields"); l.getStyleClass().add("boldLabel"); VBox.setMargin(l, new Insets(5, 5, 5, 5)); topItems.getChildren().add(l); root.setTop(topItems); sp_ = new ScrollPane(); sp_.visibleProperty().bind(assemblageIsValid_); sp_.setFitToHeight(true); sp_.setFitToWidth(true); root.setCenter(sp_); allValid_ = new UpdateableBooleanBinding() { { addBinding(assemblageIsValid_, selectableConcept_.isValid(), selectableComponentNodeValid_); } @Override protected boolean computeValue() { if (assemblageIsValid_.get() && (conceptNodeIsConceptType_ ? selectableConcept_.isValid().get() : selectableComponentNodeValid_.get())) { boolean allDataValid = true; for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { if (ssp.get().length() > 0) { allDataValid = false; break; } } if (allDataValid) { clearInvalidReason(); return true; } } setInvalidReason("All errors must be corrected before save is allowed"); return false; } }; GridPane bottomRow = new GridPane(); //spacer col bottomRow.add(new Region(), 0, 0); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction((action) -> { close(); }); GridPane.setMargin(cancelButton, new Insets(5, 20, 5, 0)); GridPane.setHalignment(cancelButton, HPos.RIGHT); bottomRow.add(cancelButton, 1, 0); Button saveButton = new Button("Save"); saveButton.disableProperty().bind(allValid_.not()); saveButton.setOnAction((action) -> { doSave(); }); Node wrappedSave = ErrorMarkerUtils.setupDisabledInfoMarker(saveButton, allValid_.getReasonWhyInvalid()); GridPane.setMargin(wrappedSave, new Insets(5, 0, 5, 20)); bottomRow.add(wrappedSave, 2, 0); //spacer col bottomRow.add(new Region(), 3, 0); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); root.setBottom(bottomRow); Scene scene = new Scene(root); scene.getStylesheets().add(AddSememePopup.class.getResource("/isaac-shared-styles.css").toString()); setScene(scene); }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddRefexPopup.java
private AddRefexPopup() { super();/*from ww w. j a va 2 s . c o m*/ BorderPane root = new BorderPane(); VBox topItems = new VBox(); topItems.setFillWidth(true); title_ = new Label("Create new sememe instance"); title_.getStyleClass().add("titleLabel"); title_.setAlignment(Pos.CENTER); title_.prefWidthProperty().bind(topItems.widthProperty()); topItems.getChildren().add(title_); VBox.setMargin(title_, new Insets(10, 10, 10, 10)); gp_ = new GridPane(); gp_.setHgap(10.0); gp_.setVgap(10.0); VBox.setMargin(gp_, new Insets(5, 5, 5, 5)); topItems.getChildren().add(gp_); Label referencedComponent = new Label("Referenced Component"); referencedComponent.getStyleClass().add("boldLabel"); gp_.add(referencedComponent, 0, 0); unselectableComponentLabel_ = new CopyableLabel(); unselectableComponentLabel_.setWrapText(true); AppContext.getService(DragRegistry.class).setupDragOnly(unselectableComponentLabel_, () -> { if (editRefex_ == null) { if (createRefexFocus_.getComponentNid() != null) { return createRefexFocus_.getComponentNid() + ""; } else { return createRefexFocus_.getAssemblyNid() + ""; } } else { return editRefex_.getRefex().getAssemblageNid() + ""; } }); //delay adding till we know which row Label assemblageConceptLabel = new Label("Assemblage Concept"); assemblageConceptLabel.getStyleClass().add("boldLabel"); gp_.add(assemblageConceptLabel, 0, 1); selectableConcept_ = new ConceptNode(null, true, refexDropDownOptions, null); selectableConcept_.getConceptProperty().addListener(new ChangeListener<ConceptVersionBI>() { @Override public void changed(ObservableValue<? extends ConceptVersionBI> observable, ConceptVersionBI oldValue, ConceptVersionBI newValue) { if (createRefexFocus_ != null && createRefexFocus_.getComponentNid() != null) { if (selectableConcept_.isValid().get()) { //Its a valid concept, but is it a valid assemblage concept? try { assemblageInfo_ = RefexDynamicUsageDescriptionBuilder .readRefexDynamicUsageDescriptionConcept( selectableConcept_.getConceptNoWait().getNid()); assemblageIsValid_.set(true); if (assemblageInfo_.getReferencedComponentTypeRestriction() != null) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn( new RefexDynamicNid(createRefexFocus_.getComponentNid()), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { selectableConcept_.isValid() .setInvalid("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction() .toString() + ", which doesn't match the referenced component."); logger_.info("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction().toString() + ", which doesn't match the referenced component."); assemblageIsValid_.set(false); } } } catch (Exception e) { selectableConcept_.isValid().setInvalid( "The selected concept is not properly constructed for use as an Assemblage concept"); logger_.info("Concept not a valid concept for a sememe assemblage", e); assemblageIsValid_.set(false); } } else { assemblageInfo_ = null; assemblageIsValid_.set(false); } buildDataFields(assemblageIsValid_.get(), null); } } }); selectableComponent_ = new TextField(); selectableComponentNodeValid_ = new ValidBooleanBinding() { { setComputeOnInvalidate(true); bind(selectableComponent_.textProperty()); invalidate(); } @Override protected boolean computeValue() { if (createRefexFocus_ != null && createRefexFocus_.getAssemblyNid() != null && !conceptNodeIsConceptType_) { //If the assembly nid was what was set - the component node may vary - validate if we are using the text field String value = selectableComponent_.getText().trim(); if (value.length() > 0) { try { if (Utility.isUUID(value)) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new RefexDynamicUUID(UUID.fromString(value)), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else if (Utility.isInt(value)) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new RefexDynamicNid(Integer.parseInt(value)), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else { setInvalidReason( "Value cannot be parsed as a component identifier. Must be a UUID or a valid NID"); return false; } } catch (Exception e) { logger_.error("Error checking component type validation", e); setInvalidReason("Unexpected error validating entry"); return false; } } else { setInvalidReason("Component identifier is required"); return false; } } clearInvalidReason(); return true; } }; selectableComponentNode_ = ErrorMarkerUtils.setupErrorMarker(selectableComponent_, null, selectableComponentNodeValid_); //delay adding concept / component till we know if / where ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); cc.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(referencedComponent)); gp_.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp_.getColumnConstraints().add(cc); Label l = new Label("Data Fields"); l.getStyleClass().add("boldLabel"); VBox.setMargin(l, new Insets(5, 5, 5, 5)); topItems.getChildren().add(l); root.setTop(topItems); sp_ = new ScrollPane(); sp_.visibleProperty().bind(assemblageIsValid_); sp_.setFitToHeight(true); sp_.setFitToWidth(true); root.setCenter(sp_); allValid_ = new UpdateableBooleanBinding() { { addBinding(assemblageIsValid_, selectableConcept_.isValid(), selectableComponentNodeValid_); } @Override protected boolean computeValue() { if (assemblageIsValid_.get() && (conceptNodeIsConceptType_ ? selectableConcept_.isValid().get() : selectableComponentNodeValid_.get())) { boolean allDataValid = true; for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { if (ssp.get().length() > 0) { allDataValid = false; break; } } if (allDataValid) { clearInvalidReason(); return true; } } setInvalidReason("All errors must be corrected before save is allowed"); return false; } }; GridPane bottomRow = new GridPane(); //spacer col bottomRow.add(new Region(), 0, 0); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction((action) -> { close(); }); GridPane.setMargin(cancelButton, new Insets(5, 20, 5, 0)); GridPane.setHalignment(cancelButton, HPos.RIGHT); bottomRow.add(cancelButton, 1, 0); Button saveButton = new Button("Save"); saveButton.disableProperty().bind(allValid_.not()); saveButton.setOnAction((action) -> { doSave(); }); Node wrappedSave = ErrorMarkerUtils.setupDisabledInfoMarker(saveButton, allValid_.getReasonWhyInvalid()); GridPane.setMargin(wrappedSave, new Insets(5, 0, 5, 20)); bottomRow.add(wrappedSave, 2, 0); //spacer col bottomRow.add(new Region(), 3, 0); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); root.setBottom(bottomRow); Scene scene = new Scene(root); scene.getStylesheets().add(AddRefexPopup.class.getResource("/isaac-shared-styles.css").toString()); setScene(scene); }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
private void addReportErrorButtons() { messageLabel.setText(truncatedMessage + "\n\nTo help us to improve the software please report the bug at our issue tracker at Github or send it by email to the developers.\n" + "The error message will be copied to clipboard when you click the below buttons.\n" + "It will make debugging easier if you can attach the bitsquare.log file which you can find in the application directory."); Button githubButton = new Button("Report to Github issue tracker"); GridPane.setMargin(githubButton, new Insets(20, 0, 0, 0)); GridPane.setHalignment(githubButton, HPos.RIGHT); GridPane.setRowIndex(githubButton, ++rowIndex); GridPane.setColumnIndex(githubButton, 1); gridPane.getChildren().add(githubButton); githubButton.setOnAction(event -> { Utilities.copyToClipboard(message); GUIUtil.openWebPage("https://github.com/bitsquare/bitsquare/issues"); });//from w w w . jav a 2s . c om Button mailButton = new Button("Report by email"); GridPane.setHalignment(mailButton, HPos.RIGHT); GridPane.setRowIndex(mailButton, ++rowIndex); GridPane.setColumnIndex(mailButton, 1); gridPane.getChildren().add(mailButton); mailButton.setOnAction(event -> { Utilities.copyToClipboard(message); GUIUtil.openMail("manfred@bitsquare.io", "Error report", "Error message:\n" + message); }); }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
protected void addCloseButton() { closeButton = new Button(closeButtonText == null ? "Close" : closeButtonText); closeButton.setOnAction(event -> doClose()); if (actionHandlerOptional.isPresent() || actionButtonText != null) { actionButton = new Button(actionButtonText == null ? "Ok" : actionButtonText); actionButton.setDefaultButton(true); //TODO app wide focus //actionButton.requestFocus(); actionButton.setOnAction(event -> { hide();/*w ww . j a va2 s . co m*/ actionHandlerOptional.ifPresent(Runnable::run); }); Pane spacer = new Pane(); HBox hBox = new HBox(); hBox.setSpacing(10); hBox.getChildren().addAll(spacer, closeButton, actionButton); HBox.setHgrow(spacer, Priority.ALWAYS); GridPane.setHalignment(hBox, HPos.RIGHT); GridPane.setRowIndex(hBox, ++rowIndex); GridPane.setColumnSpan(hBox, 2); GridPane.setMargin(hBox, new Insets(buttonDistance, 0, 0, 0)); gridPane.getChildren().add(hBox); } else if (!hideCloseButton) { closeButton.setDefaultButton(true); GridPane.setHalignment(closeButton, HPos.RIGHT); if (!showReportErrorButtons) GridPane.setMargin(closeButton, new Insets(buttonDistance, 0, 0, 0)); GridPane.setRowIndex(closeButton, ++rowIndex); GridPane.setColumnIndex(closeButton, 1); gridPane.getChildren().add(closeButton); } }