List of usage examples for javafx.scene.control Button setDefaultButton
public final void setDefaultButton(boolean value)
From source file:cz.lbenda.gui.tableView.FilterMenuItem.java
private void prepareOkCancelBar() { Button okButton = new Button(msgOK); okButton.setDefaultButton(true); Button cancelButton = new Button(msgCancel); cancelButton.setCancelButton(true);// ww w. ja v a 2 s . co m okCancelBar.getChildren().addAll(okButton, cancelButton); //noinspection unchecked final StringConverter converter = filterableTableView.stringConverter(tableColumn); okButton.setOnAction(event -> { if (filter != null) { filterableTableView.filters().remove(filter); } if (!isFilter()) { tableColumn.removeLeftIndicator(filterIndicator); } else { tableColumn.addLeftIndicator(filterIndicator); //noinspection unchecked filter = row -> { //noinspection unchecked Object value = filterableTableView.valueForColumn(row, tableColumn); String text; if (value == null) { text = ""; } else { //noinspection unchecked text = converter.toString(value); } return chosenItemNames.contains(text); }; //noinspection unchecked filterableTableView.filters().add(filter); } }); }
From source file:org.jacp.demo.components.ContactAddDialog.java
private void createAddContactDialog() { final VBox box = new VBox(); box.getStyleClass().add("jacp-option-pane"); box.setMaxSize(300, Region.USE_PREF_SIZE); // the title/*from ww w.j a va 2s .co m*/ final Label title = new Label("Add new category"); title.setId(GlobalConstants.CSSConstants.ID_JACP_CUSTOM_TITLE); VBox.setMargin(title, new Insets(2, 2, 10, 2)); final HBox hboxInput = new HBox(); final Label nameLabel = new Label("category name:"); HBox.setMargin(nameLabel, new Insets(2)); final TextField nameInput = new TextField(); HBox.setMargin(nameInput, new Insets(0, 0, 0, 5)); HBox.setHgrow(nameInput, Priority.ALWAYS); hboxInput.getChildren().addAll(nameLabel, nameInput); final HBox hboxButtons = new HBox(); hboxButtons.setAlignment(Pos.CENTER_RIGHT); final Button ok = new Button("OK"); HBox.setMargin(ok, new Insets(6, 5, 4, 2)); final Button cancel = new Button("Cancel"); HBox.setMargin(cancel, new Insets(6, 2, 4, 5)); cancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent arg0) { JACPModalDialog.getInstance().hideModalDialog(); } }); ok.setDefaultButton(true); ok.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { final String catName = nameInput.getText(); if (catName != null && StringUtils.hasText(catName)) { // contacts final Contact contact = new Contact(); contact.setFirstName(catName); parent.getContext().send(contact); JACPModalDialog.getInstance().hideModalDialog(); } } }); hboxButtons.getChildren().addAll(ok, cancel); box.getChildren().addAll(title, hboxInput, hboxButtons); JACPModalDialog.getInstance().showModalDialog(box); }
From source file:com.rcs.shoe.shop.fx.controller.ui.SaleEnterController.java
private void setQuantities(Map<Integer, V_ProductHistory> map) { for (Label label : quantityLabels.values()) { Button button = quantityButtons.get("button" + getSize(label)); V_ProductHistory quantity = map.get(getSize(label)); if (quantity != null && quantity.getQuantity() > 0) { button.setOnAction(new EventHandler<ActionEvent>() { @Override//from ww w. j a v a2s .com public void handle(ActionEvent e) { enterSale(button); } }); button.setDefaultButton(true); label.textProperty().setValue(quantity.getQuantity().toString()); } else { button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { noQuantitySale(); } }); button.setDefaultButton(false); label.textProperty().setValue("0"); } } }