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

Reply via email to