This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
hi, i was wondering if it is possible to display only the directories, exculding the files. that is it should look like the folders pane of windows explorer. if so how do we go about it. thanks saurabh sood [ May 28, 2003: Message edited by: saurabh sood ]
If you are talking about JFileChooser (which I'll assume you mean since you are talking about files, and you'd have to customize JTree to deal with files. ) all you have to do is create a subclass of javax.swing.filechooser.FileFilter that implements the accept() method like this :
then pass this file filter into the setFileFilter() method of the JFileChooser.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Nov 22, 2000
hi, thanks for replying. my real objective is to create a batch utility, that performs a set of tasks to all the files in that directory. the user selects the directory. i do know how to make only directory visible in JFileChooser. that can be done by JFileChooser jfc = new JFileChooser(); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); is it possible to display only directories in JTree thanks in advance saurabh sood