Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Jtree node view

Posted on 1998-11-19
4
Medium Priority
?
220 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
[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
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
heyhey_ earned 60 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

722 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