private void initialize() { getStyleClass().add(DEFAULT_STYLE_CLASS); this.setCellFactory(listView -> new JFXListCell<T>(){ @Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); updateDisplayText(this,item,empty); } }); // had to refactor the code out of the skin class to allow // customization of the button cell this.setButtonCell(new ListCell<T>() { { // fixed clearing the combo box value is causing // java prompt text to be shown because the button cell is not updated JFXComboBox.this.valueProperty().addListener(observable -> { if(JFXComboBox.this.getValue() == null){ updateItem(null, true ); } }); } @Override protected void updateItem(T item, boolean empty) { updateDisplayText(this, item, empty); this.setVisible(item != null || !empty); } }); }
private void initialize() { getStyleClass().add(DEFAULT_STYLE_CLASS); this.setCellFactory(listView -> new JFXListCell<T>(){ @Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); updateDisplayText(this,item,empty); } }); // had to refactor the code out of the skin class to allow // customization of the button cell this.setButtonCell(new ListCell<T>() { { // fixed clearing the combo box value is causing // java prompt text to be shown because the button cell is not updated JFXComboBox.this.valueProperty().addListener(observable -> { if(JFXComboBox.this.getValue() == null){ updateItem(null, true ); } }); } @Override protected void updateItem(T item, boolean empty) { updateDisplayText(this, item, empty); this.setVisible(item != null || !empty); } }); }