• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to invoke FileDialog from a dialog?

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but it comes from a JFrame
 
reply
    Bookmark Topic Watch Topic
  • New Topic