wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes how to invoke FileDialog  from a dialog? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to invoke FileDialog  from a dialog?" Watch "how to invoke FileDialog  from a dialog?" New topic
Author

how to invoke FileDialog from a dialog?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi All,

It appears that my File Dialog is "getting lost".

when the user clicks SaveAs the file dialog is on screen, but when he refers to a diff aplication (IE eg) and returns, the file dialog is at the back (and he cannot access it).

the user is trying to access it from a DIALOG! so I cannot use this:

Component c = SwingUtilities.getRoot((Component)e.getSource());
JFrame myFrame = (JFrame)c;

because the constructor only takes a frame
FileDialog fd = new FileDialog(frame, "Save As",FileDialog.SAVE);


anyone???
thanks
peter
Jeff Grant
Ranch Hand

Joined: Dec 19, 2001
Posts: 169
I had the same problem with JOptionPane a while ago. Turned out that frame I was passing was in fact null during my default frame constructor.

I would make sure the "frame" you pass is not null.
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
but it comes from a JFrame
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to invoke FileDialog from a dialog?