Solved

Adding a Comment between Parent and Child in JTree

Posted on 2004-08-26
8
244 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

822 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