• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to invoke FileDialog from a dialog?

 
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
 
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
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic