Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8197536

TableView, ListView: unexpected scrolling behaviour on up/down keys

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
      9

      Backports

        Description

        To reproduce, compile and run the example below:

        - press down until the last visible row is selected
        - press down again
        - expected: table/list is scrolled up by 1 row (such that the newly selected cell now is the last visible row) - that's the behaviour f.i. in win explorer
        - actual: table is scrolled up by a bit less than a page (such that the newly selected cell is the second or third row in the viewport - where exactly is hard to predict, seems to change with the amount of pages scrolled)


        The example:

        /**
         * TableView/ListView: unexpected scrolling behaviour on down/up
         *
         * not tested: TreeView, TreeTableView, might have similar issue
         */
        public class TableViewScrollOnNavigationBug extends Application {

            private Parent getContent() {
                TableView<Locale> table = new TableView<>(FXCollections.observableArrayList(
                        Locale.getAvailableLocales()));
                TableColumn<Locale, String> countryCode = new TableColumn<>("CountryCode");
                countryCode.setCellValueFactory(new PropertyValueFactory<>("country"));
                TableColumn<Locale, String> language = new TableColumn<>("Language");
                language.setCellValueFactory(new PropertyValueFactory<>("language"));
                TableColumn<Locale, String> variant = new TableColumn<>("Variant");
                variant.setCellValueFactory(new PropertyValueFactory<>("variant"));
                table.getColumns().addAll(countryCode, language, variant);
                
                ListView<Locale> list = new ListView<>(table.getItems());
                BorderPane pane = new BorderPane(table);
                pane.setRight(list);
                
                return pane;
            }

            @Override
            public void start(Stage primaryStage) throws Exception {
                primaryStage.setScene(new Scene(getContent(), 800, 400));
                primaryStage.setTitle(FXUtils.version());
                primaryStage.show();

            }
            
            public static void main(String[] args) {
                launch(args);
            }

        }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                tsayao Thiago Sayao
                Reporter:
                fastegal Jeanette Winzenburg
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: