diff options
Diffstat (limited to 'documentation/components/components-combobox.asciidoc')
-rw-r--r-- | documentation/components/components-combobox.asciidoc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/documentation/components/components-combobox.asciidoc b/documentation/components/components-combobox.asciidoc index 7f7640a079..c7a1fefba8 100644 --- a/documentation/components/components-combobox.asciidoc +++ b/documentation/components/components-combobox.asciidoc @@ -52,7 +52,7 @@ attempt to do so may result in an exception. === Handling New Items -Adding new items is handled by a [interfacename]#NewItemHandler#, which gets the +Adding new items is handled by a [interfacename]#NewItemProvider#, which gets the item caption string as parameter for the [methodname]#accept(String)# method. @@ -73,7 +73,7 @@ select.setItemCaptionGenerator(Planet::getName); // Allow adding new items and add // handling for new items -select.setNewItemHandler(inputString -> { +select.setNewItemProvider(inputString -> { Planet newPlanet = new Planet(planets.size(), inputString); planets.add(newPlanet); @@ -81,8 +81,7 @@ select.setNewItemHandler(inputString -> { // Update combobox content select.setItems(planets); - // Remember to set the selection to the new item - select.setSelectedItem(newPlanet); + return Optional.of(newPlanet); }); ---- |