Solved

Adding a Comment between Parent and Child in JTree

Posted on 2004-08-26
8
242 Views
Last Modified: 2010-03-31
Hi

I would like to add a Comment between a Parent and a child in a JTree, Is this possible, if yes..pls help me with code snippet.

My reqt is like this.

o [] Root 1                                
|     THIS IS COMMENT    (String between parent & child)
       [] Child 1
       [] Child 2
 o-[] Root 2

Any suggestion..

Thanks,
0
Comment
Question by:vibhav
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 11908270
thats just another child node isn't it.
0
 

Author Comment

by:vibhav
ID: 11908284
Yes, but I do not want to display any icon to this node (like leaf or root (folder icon).

How to renderer it.
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 11908387
use a custom tree cell renderer and only display an icon on the nodes that need one.
0
 
LVL 18

Expert Comment

by:armoghan
ID: 11909978
and how to remove Icons and show only text
see http://www.objects.com.au/java/examples/swing/TextOnlyTree.do

Thanx to Objects for putting such nice examples together;)
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 35

Expert Comment

by:girionis
ID: 11910325
0
 
LVL 16

Expert Comment

by:Valeri
ID: 11910867
Why you need comment in this way?!?! In your custom tree cell renderer you can add tool tip for each one of the nodes. Just have a look at DefaultTreeCellRenderer and write your own in the same way...
0
 
LVL 35

Expert Comment

by:girionis
ID: 11910904
0
 
LVL 92

Expert Comment

by:objects
ID: 11918384
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now