The default constructor for ChoiceDialog throws a NullPointerException
Caused by: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at javafx.scene.control.ChoiceDialog.<init>(ChoiceDialog.java:95)
at javafx.scene.control.ChoiceDialog.<init>(ChoiceDialog.java:78)
Also the Javadocs for this constructor mentions the getItems() method but I think the setItems() method was intended.
Here is a short program to trigger the NPE.
import javafx.application.Application;
import javafx.scene.control.ChoiceDialog;
import javafx.stage.Stage;
public class DialogTest2 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
ChoiceDialog<String> choiceDialog = new ChoiceDialog<>();
}
}
Caused by: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at javafx.scene.control.ChoiceDialog.<init>(ChoiceDialog.java:95)
at javafx.scene.control.ChoiceDialog.<init>(ChoiceDialog.java:78)
Also the Javadocs for this constructor mentions the getItems() method but I think the setItems() method was intended.
Here is a short program to trigger the NPE.
import javafx.application.Application;
import javafx.scene.control.ChoiceDialog;
import javafx.stage.Stage;
public class DialogTest2 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
ChoiceDialog<String> choiceDialog = new ChoiceDialog<>();
}
}