Issue
I am trying to set and get the selected value from the the combobox (which is populated by enums) but when I try selecting an item from the combobox then printing out getSelected it returns null?
Solution
If I understand you correctly, your problem is that the following line prints null
?
System.out.println(getType()); //test
This is because
- the value of
type
is not set yet - by default, the selected item of comboBox is null. You can set it with
comboBox.getSelectionModel().select(0) //or whatever value
Answered By - user16846541
Answer Checked By - David Marino (JavaFixing Volunteer)