File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Java find file path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Java find file path" Watch "Java find file path" New topic
Author

Java find file path

Rus Corina
Ranch Hand

Joined: Jul 08, 2011
Posts: 90
Hello, I am trying to make a program which creates a JTable with some info in it and then exports the table to Excel. I already found the code which does that, but I was wondering if there is a way to give the user a possibility to choose the path where he wants to save the Excel file. Like for example when you download a file from the internet and a small window appears which gives a tree-like structure of the files and folders on the computers.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

JFileChooser?
Rus Corina
Ranch Hand

Joined: Jul 08, 2011
Posts: 90
Thanks, for what I've read, I think JFileChooser is what I want. I just didn't know exactly what to search for (keyword) . It can save files as well right?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

No, it's a file chooser. It doesn't do any file saving, it just lets the user choose a file (or more precisely, the name of a file). But you already have the file-saving code written, right?
Rus Corina
Ranch Hand

Joined: Jul 08, 2011
Posts: 90
I have it, but I needed the file chooser to let me get the path where I want my file to be saved (the folder path). But I can't seem to be able to do that, to get the path. Once I have the pth, I only need to add to it the filename, which will always be the same.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Read the API for JFileChooser and follow the link to the tutorial on How to Use File Choosers. It's all there, including a fair abount of sample code.


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java find file path