• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to set different Icon for each TreeNode  RSS feed

 
Rachel Mood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using TreeTable implementation where i want to have different ImageIcon for each TreeNode.
But couldn't find any method where i can change particular treenode Icon.
If i use something like this:

TreeCellRenderer aTreeCellRenderer=mTreeTable.getTree().getCellRenderer();
DefaultTreeCellRenderer tcr = (DefaultTreeCellRenderer) aTreeCellRenderer;
ImageIcon leafImageIcon =new ImageIcon(aVehicle.getImagePath());
tcr.setLeafIcon(leafImageIcon);

It applies changes for all the leafnodes.
Can someone please suggest me how to do it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!