Solved

Jtree + Dir structure - limit to 1 level

Posted on 2003-11-10
3
331 Views
Last Modified: 2010-08-05
Hi,
  I have a Jtree that represent a directory structure like a Windows explorer.
  the root is C:\ drive

  Is it possible to limit the Jtree to show only the 1st level folder in C:\ ?
  eg:  
      C:\
          folder1   ("+" sign should be hidden if folder1 has subfolders and it is not expandable)
          folder2

Thanks.
0
Comment
Question by:peikfeng
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 9719822
Have your TreeModel return true from isLeaf() for the appropriate nodes.
0
 

Author Comment

by:peikfeng
ID: 9720166
Thanks for the clue!!  :)
I have customized my code to do this.
0
 
LVL 92

Expert Comment

by:objects
ID: 9720188
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

760 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

20 Experts available now in Live!

Get 1:1 Help Now