• Post Reply Bookmark Topic Watch Topic
  • New Topic

Keeping my custom Icon visible while editing and another question  RSS feed

kiril simeonov
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi group, I have two questions which made my life pretty unpleasant.
1. I try to edit tree nodes which contain custom Icons but at the moment as I start editing them my these vanish (Java replace them with default ones)and when I am ready with the editing they are displayed again.
I suppose I have to define my own CellEditor which extends DefaultTreeCellEditor but what I have exactly to do ???
2.The second question also concerns the editing.My problem is not managing to edit a cell again after a non valid entry has been made.The situation looks like this:
/**Adding the node to the tree*/
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("");
DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
model.insertNodeInto(newNode, selectedNode,
/**Starting editing at Path*/
TreePath treePath = new TreePath(model.getPathToRoot(newNode));
So far so good...
Then I take the value of the editor with
String newName =(String)tree.getCellEditor().getCellEditorValue();
and then I say for example
With other words if the entry is empty start editing again but I didn't work.
If anyone can help me understand my problem better than please do make your contributions. I would appreciate that much.
I thank you all in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!