I tried to find the answer to this error (which just happened to me under the same conditions) and found this post. If you really provided your ComboBox ID correctly, as jewelsea said (if not all the same, I think another error would have appeared).
The fact is that everything was well declared (no syntax error or error compilation).
Runtime error, the @FXML protected void test(ActionEvent event) is executed when filling / adding data to the ComboBox.
But the property does not change as user input has not been detected (I assume that you add data to your ComboBox somewhere else when you initialize the scene).
Therefore, getValue() returns null.
In this case, the line that broke the code:
System.out.println(output);
Since the output is null .
Try test(ActionEvent event) breakpoint at the beginning of the test(ActionEvent event) method.
I expect this help to help others too.
hmojica
source share