Solved

Jtree node view

Posted on 1998-11-19
4
201 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

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

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 81
network + 7 73
array11 challenge 16 51
backtracking recursion  code 19 40
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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.

707 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

18 Experts available now in Live!

Get 1:1 Help Now