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

[TreeTableView] Double click throws exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      jdk1.8.0b71

      Description

      To reproduce run the app and make double-click in the area below the last row.

      You will get this:

      java.lang.NullPointerException
      at com.sun.javafx.scene.control.behavior.TreeTableRowBehavior.mouseReleased(TreeTableRowBehavior.java:76)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:79)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:72)


      public class EditableTreeTableViewTest extends Application {

          TreeTableView<Person> treeTableView;
          TreeTableColumn<Person, String> firstNameCol;

          @Override
          public void start(Stage primaryStage) {

              initTreeTableView();

              HBox root = new HBox(10.0);
              root.getChildren().add(treeTableView);

              Scene scene = new Scene(root, 400, 300);

              primaryStage.setTitle(VersionInfo.getRuntimeVersion());
              primaryStage.setScene(scene);
              primaryStage.show();
          }

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

          private void initTreeTableView() {
              treeTableView = new TreeTableView<>();
              treeTableView.setMinWidth(100);
              treeTableView.setPrefWidth(100);
              treeTableView.setMaxWidth(100);
              treeTableView.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
              
              TreeItem<Person> root = new TreeItem<>(new Person("Anna"));
              root.setExpanded(true);
              treeTableView.setRoot(root);
              treeTableView.showRootProperty().set(true);

              firstNameCol = new TreeTableColumn<>("First name");
              firstNameCol.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {
                  @Override
                  public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<Person, String> p) {
                      return p.getValue().getValue().firstName;
                  }
              });
              firstNameCol.setMinWidth(80d);
              
              treeTableView.getColumns().addAll(firstNameCol);

              Person p = new Person("Bob");
              treeTableView.getRoot().getChildren().add(new TreeItem<>(p));

              p = new Person("Cindy");
              treeTableView.getRoot().getChildren().add(new TreeItem<>(p));
              
              p = new Person("Zack");
              treeTableView.getRoot().getChildren().add(new TreeItem<>(p));
          }
          
          class Person {

              public final SimpleStringProperty firstName;

              public Person(String name) {
                  this.firstName = new SimpleStringProperty(name);
              }
          }
      }

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            dzinkevi Dmitry Zinkevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved:
              Imported: