Solved

Jtree node view

Posted on 1998-11-19
4
202 Views
Last Modified: 2010-03-30
in my application, I've created a JTree.
in this tree there are folders and leaves, but the leaves are all the nodes that has no suns and they are painted as folders.
i want to control on the when it will paint the node as not a folder (even if it doesn't have sons).
how can i do it?
0
Comment
Question by:rzvika3
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
heyhey_ earned 20 total points
ID: 1227787
you have to implement your own TreeCellRenderer

you can found such an example with your Swing distribution . (I think it name was TreeDemo or something very similiar ...)

if you have some more concrete problem, post it here
hope this helps
  heyhey
0
 

Author Comment

by:rzvika3
ID: 1227788
sorry for not answering your answer.
i know that there are ways to draw,put icon etc. in a node.
as you know from the windows, even if there aren't any children in a folder it still looks as a folder and not as a file.
when you create a node, you specify whether it can have children or not.
is there a way that the drawing of the tree will get this information and according to that it will make it looks like a folder or a file?
thank you.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227789
you can modify the look&feel of the tree icons (folders/files) by implementing your own tree cell renderer, and there is such an example in your swing examples subdirectory ...

or you have some other problem ?
  heyhey

0
 

Author Comment

by:rzvika3
ID: 1227790
thank you!
if you can tell me about more example places, please do.
z.
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
Java and GPO 11 66
How to simplify a groovy script that reads a WS because the result being sent back is simpler 1 43
eclipse shortcuts 9 45
Arrays.asList  VS  ArrayList 4 44
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

914 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

15 Experts available now in Live!

Get 1:1 Help Now