jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes FileDialog save as FREEZE   ?!?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "FileDialog save as FREEZE   ?!?!" Watch "FileDialog save as FREEZE   ?!?!" New topic

FileDialog save as FREEZE ?!?!

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755

I have a JDialog on the screen and the user can Save the info in it.

the thing is that the FileDialog recieves a JFrame and as a result,
when the user switch to a diff application (say IE) and retun to the application - he can't see the FileDialog, or in other workds, the application freeze.

FileDialog fd = new FileDialog(frame, "Save As",FileDialog.SAVE);

I tried
Component c = SwingUtilities.getRoot((Component)e.getSource());
JFrame subframe = (JFrame)c;

FileDialog fd = new FileDialog(subframe , "Save As",FileDialog.SAVE);

but it doesn't work.

anyidea - I need a JDialog but the FileDialog recieves only frames ?!!?!?
Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138
Hi Peter,

using JFileChooser instead. It works.
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Save As");
int i = fileChooser.showSaveDialog(frame);

Download Java GUI Builder, <a href="http://www.mars3000.com" target="_blank" rel="nofollow">http://www.mars3000.com</a>
subject: FileDialog save as FREEZE ?!?!
It's not a secret anymore!