Explicit call to edit in treeView cell

I am implementing a custom cellFactory function for a TreeView component and I would like to call the function startEdit()

on a specific tree item. According to the javaFX documentation, the following method should work:

// "Item Title" is the title of the item to be edited
tree.edit(new TreeItem<String>("Item Title"));

      

But nothing happens when I use it. I can only start edit mode by double-clicking the tree item itself, and I would like to be able to automatically call this function when the user creates a new treeItem:

// Create a new TreeItem
TreeItem<String> item = new TreeItem<String> ("New Item");
// Insert it to the current tree
tree.getRoot().getChildren().add(item);
// Enter edit mode
tree.edit(item);

      

0


source to share





All Articles