Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to invoke FileDialog from a dialog?

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but it comes from a JFrame
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic