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

TableViewSelectionModel.selectIndices does not select index 0

XMLWordPrintable

    • b04
    • x86_64
    • linux_ubuntu

        FULL PRODUCT VERSION :
        java version "1.8.0_60"
        Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
        Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

        A DESCRIPTION OF THE PROBLEM :
        if selectIndices is called with only the argument zero, it does nothing.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        See source code.


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package sample;

        import javafx.application.Application;
        import javafx.beans.property.ReadOnlyStringWrapper;
        import javafx.collections.FXCollections;
        import javafx.scene.control.TableColumn;
        import javafx.scene.control.TableView;
        import javafx.stage.Stage;

        public class Main extends Application {

            static final int INDEX_TO_SELECT = 0;

            @Override
            public void start(Stage primaryStage) {
                final TableView root = new TableView();
                final TableColumn<?, String> col = new TableColumn("col");
                root.getColumns().add(col);
                root.setItems(FXCollections.observableArrayList(1,2,3));
                col.setCellValueFactory(data -> new ReadOnlyStringWrapper("1"));

                root.getSelectionModel().selectIndices(INDEX_TO_SELECT, new int[0]);

                assert root.getSelectionModel().isSelected(INDEX_TO_SELECT);
                System.exit(0);
            }

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

              kpk Karthik P K
              webbuggrp Webbug Group
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: