Solved

Adding a Comment between Parent and Child in JTree

Posted on 2004-08-26
8
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why my table column Id is not passed to java object? 4 46
How  can  i  resolve  HTTP Status 404 -? 8 61
java example issue 5 46
Eclipse with various Java releases 7 51
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

730 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