Solved

Jtree node view

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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…
Suggested Courses

627 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