简体   繁体   中英

Javafx - How to check if a combobox is selected or not

I'm working on a school project, but I'm having a hard time. I need to check if a combobox is selected or not in JavaFX, but I can't find the solution. I hope someone can help me out.

if (View.getPriority().getItems().size() <= 0) {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setContentText("test");
        alert.show();

This is my code. I'm trying to access my combobox from a getter in my View-class.

如果你有参考它:
boolean isSelected = !myComboBox.getSelectionModel().isEmpty();

没有看过你的代码,我假设你正在寻找combobox.isShowing()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM