Looking for a gui class to pop up to let user choose directory andfilename

S

Shawn

Hi,

When I output something to a file, I hope something pop up that let the
user to select the directory and input the file name. I don't know how
to do it. I can hard-code the file name in my program and use
PrintWriter class to do it, like:

PrintWriter outputStream = new PrintWriter(new FileOutputStream("out.txt"));

outputStream.println("hello world");
outputStream.println("how are you?);

Thank you very much for your help.
 
S

su_dang

Shawn said:
Hi,

When I output something to a file, I hope something pop up that let the
user to select the directory and input the file name. I don't know how
to do it. I can hard-code the file name in my program and use
PrintWriter class to do it, like:

PrintWriter outputStream = new PrintWriter(new FileOutputStream("out.txt"));

outputStream.println("hello world");
outputStream.println("how are you?);

Thank you very much for your help.

Maybe this is the class you are looking for

javax.swing.JFileChooser
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top