I suggest trying the solution from a small jalvafx library utility
List<String> items = Arrays.asList("Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Neptune");
ComboBoxCustomizer.create(comboBox)
.autocompleted(items)
.customize();
By default, double-click to clear the value. There are other useful features. You can add additional columns or glyphs, select individual elements, change the default elements to represent a row ...
ComboBoxCustomizer.create(comboBox)
.autocompleted(items)
.overrideToString(o -> "planet: " + o)
.multyColumn(o -> Arrays.asList("column 2", "column 3"))
.emphasized(o -> o.endsWith("s"))
.customize();
source
share