• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

FileDialog save as FREEZE ?!?!

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

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 ?!!?!?
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

using JFileChooser instead. It works.
------------------------------
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Save As");
int i = fileChooser.showSaveDialog(frame);
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic