Java 1.4.2 on Mac OS X: FileDialog doesn't work

H

Hans Stoessel

Hi

I use the FileDialog on Mac OS X / Java 1.4.2 like follows:

------------------------------------------------------------------
FileDialog oDialog = new FileDialog(this,
"Save file",

FileDialog.SAVE);
oDialog.setDirectory(new File("Temp/Test.txt").getPath());
oDialog.setFile(new File("Temp/Test.txt").getName());
oDialog.show();
if (oDialog.getDirectory() != null && oDialog.getFile() != null) {
String sFilename = oDialog.getDirectory() + oDialog.getFile();
}
------------------------------------------------------------------

But I can't select an existing file or input a new file name. sFilename is
always empty. It seems that the dialog doesn't get the selected or inputed
filenames.

- Is anything wrong with this code?
- Is this error known?

Thanks for some help.

Regards
Hans
 
H

Hans Stoessel

More info:

It works if I select a directory and input a filename. But I can't select an
existing file with a mouse click. Is that the normal behavior?

Regards
Hans
 
M

Mickey Segal

Hans Stoessel said:
It works if I select a directory and input a filename. But I can't select an
existing file with a mouse click. Is that the normal behavior?

Although there are a huge number of problems with Java 1.4 on the Macintosh
(detailed at http://segal.org/macjavabugs/) I don't recall seeing this
problem with FileDialog (using signed applets running in Safari). However,
the only Java version I have available now for testing is a developer
preview of the next version of Java 1.4. I can't describe FileDialog
behavior in this environment unless we have this discussion on the Apple
mailing list to which one is admitted after signing the nondisclosure
agreement for the developer preview (http://developer.apple.com/java/; Java
1.4.2 Update 1 Developer Preview 3).
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top