Java Code Examples for javafx.scene.control.ComboBox#setId()

The following examples show how to use javafx.scene.control.ComboBox#setId() . 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: ComboBoxSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ComboBoxSample() {

        HBox hbox = HBoxBuilder.create().alignment(Pos.CENTER).spacing(15).build();
               
        //Non-editable combobox. Created with a builder
        ComboBox uneditableComboBox = ComboBoxBuilder.create()
                .id("uneditable-combobox")
                .promptText("Make a choice...")
                .items(FXCollections.observableArrayList(strings.subList(0, 8))).build();

        //Editable combobox. Use the default item display length
        ComboBox<String> editableComboBox = new ComboBox<String>();
        editableComboBox.setId("second-editable");
        editableComboBox.setPromptText("Edit or Choose...");
        editableComboBox.setItems(strings);
        editableComboBox.setEditable(true);

        hbox.getChildren().addAll(uneditableComboBox, editableComboBox);
        getChildren().add(hbox);
    }
 
Example 2
Source File: ComboBoxSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ComboBoxSample() {

        HBox hbox = HBoxBuilder.create().alignment(Pos.CENTER).spacing(15).build();
               
        //Non-editable combobox. Created with a builder
        ComboBox uneditableComboBox = ComboBoxBuilder.create()
                .id("uneditable-combobox")
                .promptText("Make a choice...")
                .items(FXCollections.observableArrayList(strings.subList(0, 8))).build();

        //Editable combobox. Use the default item display length
        ComboBox<String> editableComboBox = new ComboBox<String>();
        editableComboBox.setId("second-editable");
        editableComboBox.setPromptText("Edit or Choose...");
        editableComboBox.setItems(strings);
        editableComboBox.setEditable(true);

        hbox.getChildren().addAll(uneditableComboBox, editableComboBox);
        getChildren().add(hbox);
    }
 
Example 3
Source File: MainView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
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 4
Source File: SplitAfterPredefinedSetOfPagesRadioButtonTest.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    ComboBox<KeyStringValueItem<PredefinedSetOfPages>> combo = new ComboBox<>();
    combo.setId("combo");
    combo.getItems().add(KeyStringValueItem.keyValue(PredefinedSetOfPages.ALL_PAGES, "Every page"));
    combo.getItems().add(KeyStringValueItem.keyValue(PredefinedSetOfPages.EVEN_PAGES, "Even pages"));
    combo.getItems().add(KeyStringValueItem.keyValue(PredefinedSetOfPages.ODD_PAGES, "Odd pages"));
    victim = new SplitAfterPredefinedSetOfPagesRadioButton(combo);
    victim.setId("victim");
    Scene scene = new Scene(new HBox(victim, combo));
    stage.setScene(scene);
    stage.show();
}