Details
-
Bug
-
Resolution: Fixed
-
P4
-
jfx11, 8, jfx17, jfx18
-
b03
-
generic
-
generic
Description
When a null SelectionModel/FocusModel is set in a ListView, it will throw NPEs on various different actions,
e.g. on clicking on a ListCell with a null SelectionModel or pressing space with a null FocusModel and more
Example: Click on the first ListCell or press SPACE.
### SOURCE START ###
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class FXBug extends Application {
public static void main(final String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) {
ListView<String> listView = new ListView<>();
listView.getItems().addAll("ABC", "DEF");
listView.setFocusModel(null);
listView.setSelectionModel(null);
BorderPane root = new BorderPane(listView);
final Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
}
### SOURCE END ###
e.g. on clicking on a ListCell with a null SelectionModel or pressing space with a null FocusModel and more
Example: Click on the first ListCell or press SPACE.
### SOURCE START ###
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class FXBug extends Application {
public static void main(final String[] args) {
launch(args);
}
@Override
public void start(final Stage primaryStage) {
ListView<String> listView = new ListView<>();
listView.getItems().addAll("ABC", "DEF");
listView.setFocusModel(null);
listView.setSelectionModel(null);
BorderPane root = new BorderPane(listView);
final Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
}
### SOURCE END ###
Attachments
Issue Links
- duplicates
-
JDK-8230098 NPEs in ListView with no SelectionModel
- Closed
- relates to
-
JDK-8187145 (Tree)TableView with null selectionModel: throws NPE on sorting
- Resolved
-
JDK-8296413 Tree/TableView with null focus model throws NPE in queryAccessibleAttribute()
- Resolved