Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Keeping my custom Icon visible while editing and another question

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Bookmark Topic Watch Topic
  • New Topic