Solved

Adding a Comment between Parent and Child in JTree

Posted on 2004-08-26
8
243 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 85
mockito example issue 8 62
map related example 6 32
tomcat not starting 6 29
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

911 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

21 Experts available now in Live!

Get 1:1 Help Now