This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Custom JTree addings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Custom JTree addings" Watch "Custom JTree addings" New topic

Custom JTree addings

Luciano Terreri

Joined: Feb 02, 2010
Posts: 1
Hi all, i have this problem:

I have a class A , in which i define my DefaultMutableTreeNode:

I add element on with a method that receive a parameter from another class B:

This methods receive a string, it is the user's nickname.
Now my problem is:
I want to modify this method to add on this JTree some others items, like 1 ImageIcon (for each node, a custom icon), the String s, and another String b.
How can i do?
I saw some threads that indicate to use TreeCellRenderer, but i am not able to use this TreeCellRenderer in my case.

Can you help me please?

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10744

Thanks Michael.

Please read

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Custom JTree addings
It's not a secret anymore!