This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Creating a browse button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Creating a browse button" Watch "Creating a browse button" New topic
Author

Creating a browse button

Bharadwaj Adepu
Ranch Hand

Joined: Dec 30, 2007
Posts: 99
Hi how can i ceate a browse button using swing?

But actualy i want to browse and select a directory and
not a specific file how do i do that?

If the answer is JFileChooser how can the directory selection is possible with that.


SCJP 1.5
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html

About a quarter way down the page:


Finally, the example program has commented-out lines of code that let you change the file selection mode. For example, the following line of code makes the file chooser able to select only directories, and not files:

fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);


GenRocket - Experts at Building Test Data
 
jQuery in Action, 2nd edition
 
subject: Creating a browse button
 
Similar Threads
how to upload an image through jsp
How I can put a Browse button?
File Chooser Dialog box
How To Make the "Browse ..." Button Work?
Browse Button in HTML For Directory Selection