Details
-
Bug
-
Resolution: Fixed
-
P3
-
8u20
Description
If a ListView contains traversable items, after you scroll the list, the traversal order becomes random.
Run the sample below. Focus should be on the first CheckBox. Tab and notice the focus moves down the list. Now scroll the list down and back up. Start off again at the first CheckBox and hit tab a few times to see that the focus jumps around.
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
static class Data {
String lbl;
ObservableBooleanValue selected;
Data(String lbl) { this.lbl = lbl; this.selected = new SimpleBooleanProperty(false); }
@Override public String toString() { return lbl; }
}
@Override
public void start(final Stage stage) throws Exception {
ListView<Data> listView = new ListView<Data>();
ObservableList<Data> items = listView.getItems();
for (int n=0; n<100; n++) { items.add(new Data("Item " + n)); }
listView.setCellFactory(CheckBoxListCell.forListView((data) -> { return data.selected; } ));
Scene scene = new Scene(listView);
stage.setScene(scene);
stage.show();
}
}
Run the sample below. Focus should be on the first CheckBox. Tab and notice the focus moves down the list. Now scroll the list down and back up. Start off again at the first CheckBox and hit tab a few times to see that the focus jumps around.
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
static class Data {
String lbl;
ObservableBooleanValue selected;
Data(String lbl) { this.lbl = lbl; this.selected = new SimpleBooleanProperty(false); }
@Override public String toString() { return lbl; }
}
@Override
public void start(final Stage stage) throws Exception {
ListView<Data> listView = new ListView<Data>();
ObservableList<Data> items = listView.getItems();
for (int n=0; n<100; n++) { items.add(new Data("Item " + n)); }
listView.setCellFactory(CheckBoxListCell.forListView((data) -> { return data.selected; } ));
Scene scene = new Scene(listView);
stage.setScene(scene);
stage.show();
}
}
Attachments
Issue Links
- relates to
-
JDK-8095651 Add tests for custom TraversalEngines that were introduced in RT-36065
- Resolved