Java file open/save dialog box

T

Terry

I am creating a Java application and I need something like the Microsoft
File Open and Save As dialog boxes.
Does anyone have an example of Java versions or should I (can I) use the
Microsoft dialog boxes.

Terry
 
N

nos

Terry said:
I am creating a Java application and I need something like the Microsoft
File Open and Save As dialog boxes.
Does anyone have an example of Java versions or should I (can I) use the
Microsoft dialog boxes.

Terry
Here is a snip from one of my programs. wd is used
to start the dialog box in the users home directory.

-----------------
String wd = System.getProperty("user.dir");
JFileChooser fc = new JFileChooser(wd);
int rc = fc.showDialog(null, "Select Data File");
if (rc == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
filename = file.getAbsolutePath();
// call your function here
}
else
System.out.println("File chooser cancel button clicked");
return;
 
J

Jon A. Cruz

nos said:
Here is a snip from one of my programs. wd is used
to start the dialog box in the users home directory.


And just set the look and feel to the default platform look and feel at
runtime and you'll get the MS ones on WinXP.
 

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

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top