com.jfoenix.controls.JFXComboBox Java Examples
The following examples show how to use
com.jfoenix.controls.JFXComboBox.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RevolutForm.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
ComboBox<Country> addCountrySelection() { HBox hBox = new HBox(); hBox.setSpacing(5); ComboBox<Country> countryComboBox = new JFXComboBox<>(); hBox.getChildren().add(countryComboBox); addTopLabelWithVBox(gridPane, ++gridRow, Res.get("payment.bank.country"), hBox, 0); countryComboBox.setPromptText(Res.get("payment.select.bank.country")); countryComboBox.setConverter(new StringConverter<>() { @Override public String toString(Country country) { return country.name + " (" + country.code + ")"; } @Override public Country fromString(String s) { return null; } }); return countryComboBox; }
Example #2
Source File: RestRequestEditController.java From milkman with MIT License | 6 votes |
public RestRequestEditControllerFxml(RestRequestEditController controller) { HBox.setHgrow(this, Priority.ALWAYS); var methods = new JFXComboBox<String>(); add(methods); methods.setId("httpMethods"); controller.httpMethod = methods; methods.setValue("GET"); methods.getItems().add("GET"); methods.getItems().add("POST"); methods.getItems().add("PUT"); methods.getItems().add("DELETE"); methods.getItems().add("PATCH"); methods.getItems().add("HEAD"); methods.getItems().add("OPTIONS"); controller.requestUrl = add(new LongTextField(), true); controller.requestUrl.setId("requestUrl"); }
Example #3
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Set up the crew sponsor choice */ public void setUpCrewSponsor() { // String n[] = new String[SIZE_OF_CREW]; for (int i = 0; i < SIZE_OF_CREW; i++) { String sponsor = personConfig.getConfiguredPersonSponsor(i, ALPHA_CREW); System.out.println("setUpCrewSponsor sponsor : " + sponsor); // if (!sponsor.equals(sponsorName)) { // sponsor = sponsorName; // } JFXComboBox<String> g = setUpCB(SPONSOR_ROW, i); // 4 = sponsor // g.setMaximumRowCount(8); gridPane.add(g, i + 1, SPONSOR_ROW); // sponsor's row = 4 g.setValue(sponsor);//n[i]); sponsorList.add(i, g); } }
Example #4
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public void createFXSettlementComboBox() { sBox = new JFXComboBox<>(); sBox.getStyleClass().add("jfx-combo-box"); setQuickToolTip(sBox, Msg.getString("SettlementWindow.tooltip.selectSettlement")); //$NON-NLS-1$ changeSBox(); // sBox.itemsProperty().setValue(FXCollections.observableArrayList(unitManager.getSettlements())); sBox.setPromptText("Select a settlement to view"); sBox.getSelectionModel().selectFirst(); sBox.valueProperty().addListener((observable, oldValue, newValue) -> { if (oldValue != newValue) { SwingUtilities.invokeLater(() -> mapPanel.setSettlement((Settlement) newValue)); } }); settlementBox = new StackPane(sBox); settlementBox.setOpacity(1); settlementBox.setMaxSize(180, 30); settlementBox.setPrefSize(180, 30); settlementBox.setAlignment(Pos.CENTER_RIGHT); }
Example #5
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Set up the crew gender choice */ public void setUpCrewGender() { String s[] = new String[SIZE_OF_CREW]; for (int j = 0; j < SIZE_OF_CREW; j++) { GenderType n = personConfig.getConfiguredPersonGender(j, ALPHA_CREW); // convert MALE to M, FEMAL to F s[j] = n.toString(); if (s[j].equals("MALE")) s[j] = "M"; else s[j] = "F"; JFXComboBox<String> g = setUpCB(GENDER_ROW, j); // 2 = Gender // g.setMaximumRowCount(2); gridPane.add(g, j + 1, GENDER_ROW); // gender's row = 2 // genderOListComboBox.add(g); g.setValue(s[j]); genderList.add(j, g); } }
Example #6
Source File: FormBuilder.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
public static <T> ComboBox<T> addComboBox(GridPane gridPane, int rowIndex, String title, double top) { JFXComboBox<T> comboBox = new JFXComboBox<>(); comboBox.setLabelFloat(true); comboBox.setPromptText(title); comboBox.setMaxWidth(Double.MAX_VALUE); // Default ComboBox does not show promptText after clear selection. // https://stackoverflow.com/questions/50569330/how-to-reset-combobox-and-display-prompttext?noredirect=1&lq=1 comboBox.setButtonCell(getComboBoxButtonCell(title, comboBox)); GridPane.setRowIndex(comboBox, rowIndex); GridPane.setColumnIndex(comboBox, 0); GridPane.setMargin(comboBox, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0)); gridPane.getChildren().add(comboBox); return comboBox; }
Example #7
Source File: FormBuilder.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
public static <T> Tuple4<ComboBox<T>, Label, TextField, HBox> addComboBoxTopLabelTextField(GridPane gridPane, int rowIndex, String titleCombobox, String titleTextfield, double top) { HBox hBox = new HBox(); hBox.setSpacing(10); JFXComboBox<T> comboBox = new JFXComboBox<>(); comboBox.setPromptText(titleCombobox); comboBox.setLabelFloat(true); TextField textField = new BisqTextField(); final VBox topLabelVBox = getTopLabelVBox(5); final Label topLabel = getTopLabel(titleTextfield); topLabelVBox.getChildren().addAll(topLabel, textField); hBox.getChildren().addAll(comboBox, topLabelVBox); GridPane.setRowIndex(hBox, rowIndex); GridPane.setMargin(hBox, new Insets(top, 0, 0, 0)); gridPane.getChildren().add(hBox); return new Tuple4<>(comboBox, topLabel, textField, hBox); }
Example #8
Source File: FormBuilder.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
public static <T> Tuple3<Label, ComboBox<T>, Button> addLabelComboBoxButton(GridPane gridPane, int rowIndex, String title, String buttonTitle, double top) { Label label = addLabel(gridPane, rowIndex, title, top); HBox hBox = new HBox(); hBox.setSpacing(10); Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); ComboBox<T> comboBox = new JFXComboBox<>(); hBox.getChildren().addAll(comboBox, button); GridPane.setRowIndex(hBox, rowIndex); GridPane.setColumnIndex(hBox, 1); GridPane.setMargin(hBox, new Insets(top, 0, 0, 0)); gridPane.getChildren().add(hBox); return new Tuple3<>(label, comboBox, button); }
Example #9
Source File: FormBuilder.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
public static <T> Tuple3<Label, ComboBox<T>, TextField> addLabelComboBoxLabel(GridPane gridPane, int rowIndex, String title, String textFieldText, double top) { Label label = addLabel(gridPane, rowIndex, title, top); HBox hBox = new HBox(); hBox.setSpacing(10); ComboBox<T> comboBox = new JFXComboBox<>(); TextField textField = new TextField(textFieldText); textField.setEditable(false); textField.setMouseTransparent(true); textField.setFocusTraversable(false); hBox.getChildren().addAll(comboBox, textField); GridPane.setRowIndex(hBox, rowIndex); GridPane.setColumnIndex(hBox, 1); GridPane.setMargin(hBox, new Insets(top, 0, 0, 0)); gridPane.getChildren().add(hBox); return new Tuple3<>(label, comboBox, textField); }
Example #10
Source File: FormBuilder.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
public static <T, R> Tuple3<Label, ComboBox<T>, ComboBox<R>> addTopLabelComboBoxComboBox(GridPane gridPane, int rowIndex, String title, double top) { HBox hBox = new HBox(); hBox.setSpacing(10); ComboBox<T> comboBox1 = new JFXComboBox<>(); ComboBox<R> comboBox2 = new JFXComboBox<>(); hBox.getChildren().addAll(comboBox1, comboBox2); final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top); return new Tuple3<>(topLabelWithVBox.first, comboBox1, comboBox2); }
Example #11
Source File: FormBuilder.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
public static <T> Tuple3<VBox, Label, ComboBox<T>> addTopLabelComboBox(String title, String prompt, int top) { Label label = getTopLabel(title); VBox vBox = getTopLabelVBox(top); final JFXComboBox<T> comboBox = new JFXComboBox<>(); comboBox.setPromptText(prompt); vBox.getChildren().addAll(label, comboBox); return new Tuple3<>(vBox, label, comboBox); }
Example #12
Source File: FormBuilder.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
public static <T> ComboBox<T> addComboBox(GridPane gridPane, int rowIndex, int top) { final JFXComboBox<T> comboBox = new JFXComboBox<>(); GridPane.setRowIndex(comboBox, rowIndex); GridPane.setMargin(comboBox, new Insets(top, 0, 0, 0)); gridPane.getChildren().add(comboBox); return comboBox; }
Example #13
Source File: MainView.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
private Tuple2<ComboBox<PriceFeedComboBoxItem>, VBox> getMarketPriceBox() { VBox marketPriceBox = new VBox(); marketPriceBox.setAlignment(Pos.CENTER_LEFT); ComboBox<PriceFeedComboBoxItem> priceComboBox = new JFXComboBox<>(); priceComboBox.setVisibleRowCount(12); priceComboBox.setFocusTraversable(false); priceComboBox.setId("price-feed-combo"); priceComboBox.setPadding(new Insets(0, -4, -4, 0)); priceComboBox.setCellFactory(p -> getPriceFeedComboBoxListCell()); ListCell<PriceFeedComboBoxItem> buttonCell = getPriceFeedComboBoxListCell(); buttonCell.setId("price-feed-combo"); priceComboBox.setButtonCell(buttonCell); Label marketPriceLabel = new Label(); updateMarketPriceLabel(marketPriceLabel); marketPriceLabel.getStyleClass().add("nav-balance-label"); marketPriceLabel.setPadding(new Insets(-2, 0, 4, 9)); marketPriceBox.getChildren().addAll(priceComboBox, marketPriceLabel); model.getMarketPriceUpdated().addListener((observable, oldValue, newValue) -> updateMarketPriceLabel(marketPriceLabel)); return new Tuple2<>(priceComboBox, marketPriceBox); }
Example #14
Source File: JFXComboBoxListViewSkin.java From JFoenix with Apache License 2.0 | 5 votes |
/*************************************************************************** * * * Constructors * * * **************************************************************************/ public JFXComboBoxListViewSkin(final JFXComboBox<T> comboBox) { super(comboBox); linesWrapper = new PromptLinesWrapper<>( comboBox, promptTextFill, comboBox.valueProperty(), comboBox.promptTextProperty(), () -> promptText); linesWrapper.init(() -> createPromptNode()); linesWrapper.clip.widthProperty().bind(linesWrapper.promptContainer.widthProperty().subtract(arrowButton.widthProperty())); errorContainer = new ValidationPane<>(comboBox); getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer); if (comboBox.isEditable()) { comboBox.getEditor().setStyle("-fx-background-color:TRANSPARENT;-fx-padding: 0.333333em 0em;"); comboBox.getEditor().promptTextProperty().unbind(); comboBox.getEditor().setPromptText(null); comboBox.getEditor().textProperty().addListener((o, oldVal, newVal) -> { linesWrapper.usePromptText.invalidate(); comboBox.setValue(getConverter().fromString(newVal)); }); } registerChangeListener(comboBox.disableProperty(), "DISABLE_NODE"); registerChangeListener(comboBox.focusColorProperty(), "FOCUS_COLOR"); registerChangeListener(comboBox.unFocusColorProperty(), "UNFOCUS_COLOR"); registerChangeListener(comboBox.disableAnimationProperty(), "DISABLE_ANIMATION"); }
Example #15
Source File: ComboBoxDemo.java From JFoenix with Apache License 2.0 | 5 votes |
@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(); }
Example #16
Source File: GeneralSepaForm.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
ComboBox<Country> addCountrySelection() { HBox hBox = new HBox(); hBox.setSpacing(10); ComboBox<Country> countryComboBox = new JFXComboBox<>(); currencyTextField = new JFXTextField(""); currencyTextField.setEditable(false); currencyTextField.setMouseTransparent(true); currencyTextField.setFocusTraversable(false); currencyTextField.setMinWidth(300); currencyTextField.setVisible(true); currencyTextField.setManaged(true); currencyTextField.setText(Res.get("payment.currencyWithSymbol", euroCurrency.getNameAndCode())); hBox.getChildren().addAll(countryComboBox, currencyTextField); addTopLabelWithVBox(gridPane, ++gridRow, Res.get("payment.bank.country"), hBox, 0); countryComboBox.setPromptText(Res.get("payment.select.bank.country")); countryComboBox.setConverter(new StringConverter<>() { @Override public String toString(Country country) { return country.name + " (" + country.code + ")"; } @Override public Country fromString(String s) { return null; } }); return countryComboBox; }
Example #17
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Sets up the sponsor combobox * * @return {@link JFXComboBox} */ public JFXComboBox<String> setUpDestinationCB() { retrieveFromTable(); // destinationsOListComboBox = new JFXComboBox<String>(destinationsOList); destinationsOListComboBox.setItems(destinationsOList); return destinationsOListComboBox; }
Example #18
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Sets up the gender combobox * * @param index * @return {@link JFXComboBox} */ public JFXComboBox<String> setUpGenderCB(int index) { // List<String> genderList = new ArrayList<String>(2); // genderList.add("M"); // genderList.add("F"); List<String> genderList = Arrays.asList("M", "F"); ObservableList<String> genderOList = FXCollections.observableArrayList(genderList); JFXComboBox<String> cb = new JFXComboBox<String>(genderOList); // genderCBs.add(index, cb); return cb; }
Example #19
Source File: SelectValueDialog.java From milkman with MIT License | 5 votes |
public SelectValueDialogFxml(SelectValueDialog controller){ setHeading(controller.title = label("Title")); var vbox = new FxmlBuilder.VboxExt(); controller.promptLabel = vbox.add(label("")); controller.valueSelection = vbox.add(new JFXComboBox<>()); setBody(vbox); setActions(submit(controller::onSave), cancel(controller::onCancel)); }
Example #20
Source File: ImportDialog.java From milkman with MIT License | 5 votes |
public ImportDialogFxml(ImportDialog controller){ setHeading(label("Import")); var vbox = new FxmlBuilder.VboxExt(); controller.importerSelector = vbox.add(new JFXComboBox()); controller.importerArea = vbox.add(vbox("importerArea")); setBody(vbox); setActions(submit(controller::onImport, "Import"), cancel(controller::onClose, "Close")); }
Example #21
Source File: ExportDialog.java From milkman with MIT License | 5 votes |
public ExportDialogFxml(ExportDialog controller){ setHeading(label("Export")); var vbox = new FxmlBuilder.VboxExt(); controller.exportSelector = vbox.add(new JFXComboBox()); controller.exportArea = vbox.add(vbox("exportArea")); setBody(vbox); controller.exportBtn = submit(controller::onExport, "Export"); setActions(controller.exportBtn, cancel(controller::onClose, "Close")); }
Example #22
Source File: AutoCompleteComboBoxListener.java From Path-of-Leveling with MIT License | 5 votes |
AutoCompleteComboBoxListener(final JFXComboBox<T> comboBox) { this.comboBox = comboBox; data = comboBox.getItems(); //this.comboBox.setEditable(true); this.comboBox.setOnKeyPressed(t -> comboBox.hide()); this.comboBox.setOnKeyReleased(AutoCompleteComboBoxListener.this); this.sc = this.comboBox.getConverter(); }
Example #23
Source File: ServiceInputLuggageViewController.java From Corendon-LostLuggage with MIT License | 5 votes |
public String checkComboBox(JFXComboBox comboBox){ if(comboBox.getValue() != null && !comboBox.getValue().toString().isEmpty()){ return comboBox.getValue().toString(); }else{ return ""; } }
Example #24
Source File: DropdownLangGUIOption.java From MSPaintIDE with MIT License | 5 votes |
@Override public Control getDisplay() { var comboBox = new JFXComboBox<String>(); comboBox.getItems().addAll(options); comboBox.valueProperty().bindBidirectional(this.text); comboBox.getStyleClass().addAll("theme-text", "language-selection"); GridPane.setColumnIndex(comboBox, 1); return comboBox; }
Example #25
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Set up the crew country choice */ public void setUpCrewCountry() { String n[] = new String[SIZE_OF_CREW]; for (int i = 0; i < SIZE_OF_CREW; i++) { n[i] = personConfig.getConfiguredPersonCountry(i, ALPHA_CREW); JFXComboBox<String> g = setUpCB(COUNTRY_ROW, i); // 5 = Country // g.setMaximumRowCount(8); gridPane.add(g, i + 1, COUNTRY_ROW); // country's row = 5 g.setValue(n[i]); System.out.println("setUpCrewCountry country : " + n[i]); countryList.add(i, g); } }
Example #26
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Set up the crew job choice */ public void setUpCrewJob() { String n[] = new String[SIZE_OF_CREW]; for (int i = 0; i < SIZE_OF_CREW; i++) { n[i] = personConfig.getConfiguredPersonJob(i, ALPHA_CREW); JFXComboBox<String> g = setUpCB(JOB_ROW, i); // 3 = Job // g.setMaximumRowCount(8); gridPane.add(g, i + 1, JOB_ROW); // job's row = 3 g.setValue(n[i]); jobList.add(i, g); } }
Example #27
Source File: JFXComboBoxListViewSkin.java From JFoenix with Apache License 2.0 | 4 votes |
@Override public boolean isSettable(JFXComboBox n) { final JFXComboBoxListViewSkin<?> skin = (JFXComboBoxListViewSkin<?>) n.getSkin(); return skin.promptTextFill == null || !skin.promptTextFill.isBound(); }
Example #28
Source File: JFXComboBoxListViewSkin.java From JFoenix with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") public StyleableProperty<Paint> getStyleableProperty(JFXComboBox n) { final JFXComboBoxListViewSkin<?> skin = (JFXComboBoxListViewSkin<?>) n.getSkin(); return (StyleableProperty<Paint>) skin.promptTextFill; }
Example #29
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Sets up the comboboxes * * @param choice * @param index * @return {@link JFXComboBox} */ public JFXComboBox<String> setUpCB(int choice, int index) { JFXComboBox<String> m = null; if (choice == GENDER_ROW) m = setUpGenderCB(index); else if (choice == JOB_ROW) m = setUpJobCB(index); else if (choice == SPONSOR_ROW) m = setUpSponsorCB(index); else if (choice == COUNTRY_ROW) m = setUpCountryCB(index); // else if (choice == 4) // m = setUpPersonalityCB(); else if (choice == DESTINATION_ROW) m = setUpDestinationCB(); final JFXComboBox<String> g = m; // g.setPadding(new Insets(10,10,10,10)); // g.setId("combobox"); // if (g != null) { // g.setOnAction((event) -> { // String s = (String) g.getValue(); // g.setValue(s); // // vs = new ValidationSupport(); // vs.registerValidator(g, Validator.createEmptyValidator( "ComboBox Selection required")); ///* // vs.validationResultProperty().addListener( (o, wasInvalid, isNowInvalid) -> { // //Collection<?> c // boolean b = o.getValue().getMessages().contains("ComboBox Selection required"); // if (b) // System.out.println("Missing ComboBox Selection(s) in Crew Editor. Please double check!"); // //if (o.getValue() == null || o.getValue().equals("")) // // System.out.println("invalid choice of country of origin !"); // } // ); //*/ // vs.invalidProperty().addListener((obs, wasInvalid, isNowInvalid) -> { // if (isNowInvalid) { // System.out.println("Missing a comboBox selection in Crew Editor!"); // } else { // System.out.println("That comboBox selection is now valid"); // } // }); // // commitButton.disableProperty().bind(vs.invalidProperty()); // }); // } return g; }
Example #30
Source File: CrewEditorFX.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * * @param simulationConfig SimulationConfig * @param scenarioConfigEditorFX ScenarioConfigEditorFX */ public CrewEditorFX(SimulationConfig simulationConfig, ScenarioConfigEditorFX scenarioConfigEditorFX) { this.personConfig = simulationConfig.getPersonConfiguration(); this.scenarioConfigEditorFX = scenarioConfigEditorFX; personalityArray = new boolean[4][SIZE_OF_CREW]; nameTF = new ArrayList<JFXTextField>(); genderList = new ArrayList<JFXComboBox<String>>(); jobList = new ArrayList<JFXComboBox<String>>(); countryList = new ArrayList<JFXComboBox<String>>(); sponsorList = new ArrayList<JFXComboBox<String>>(); createGUI(); }