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
java javafx-2 treeview


source to share


No one has answered this question yet

See similar questions:

3
Edit TreeView / TreeItem Programmatically

or similar:

2108
How can I call one constructor from another in Java?
1187
Is null check required before calling instanceof?
4
How to search JavaFX TreeView for next TreeItem?
3
Edit TreeView / TreeItem Programmatically
2
Why is the JavaFX TreeTableView edit mode undesirably canceled?
2
How do I define a simple model for a complex TreeView <t> in JavaFX 8?
1
JavaFX: how to handle dragging an item from a TreeView
1
Error entering type in treeView in javafx using public void updateItem (String item, boolean empty) method
0
JavaFX 2 TreeView - How to change the default behavior of entering edit mode?
0
Handling selected treeview items in JavaFX8



All Articles
Loading...
X
Show
Funny
Dev
Pics