ComboBox item disappearing when selected
Cormac Redmond
credmond at certak.com
Sat Nov 8 21:26:44 UTC 2025
Hi,
There is a bug whereby if you select a ComboBox item the item disappears /
becomes invisible.
This ComboBox consists of strings and a Label node and the Label node will
disappear from the dropdown if it's selected (though, continue to take
up space).
I'm just picking a Label for example, it appears to happen with any Node
that I've tried.
[image: bug_cb.gif]
Steps to reproduce (JFX 26, master branch). Note: I've kept the sample small
intentionally, but if you use a CellFactory (to call setText() or setGraphic
() accordingly, as normal), the *same* thing happens. In other words, the
bug doesn't seem to be because of "mis-use" of the ComboBox by mixing types
-- I think.
public class ComboBoxDisappearingItemBug extends Application {
public static void main(String[] args) {
launch(args);
}
public void start(Stage stage) {
ComboBox<Object> cb = new ComboBox<>();
cb.getItems().addAll("Apple", "Banana", new Label("I will
disappear"), "Carrot", "Lettuce");
cb.getSelectionModel().selectFirst();
stage.setScene(new Scene(cb, 200, 100));
stage.show();
}
}
Kind Regards,
Cormac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251108/4844af23/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_cb.gif
Type: image/gif
Size: 85745 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251108/4844af23/bug_cb-0001.gif>
More information about the openjfx-dev
mailing list