Solved

Jtree + Dir structure - limit to 1 level

Posted on 2003-11-10
3
335 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
[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
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
String array comparison 4 46
Which non-HTML GUI front end to use with Java? 3 52
Html Table Looping (part 2) 5 35
java mysql insert application 14 47
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…
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…
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:
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.

726 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