Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FileDialog problem  RSS feed

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys
I�m having a problem with open up a filedialog.
I have a rendered jlist and the are some items inside. The user, can right click any item and choose from a list some commands (print, save, update etc)

Everything works fine but when he clicks the SAVE option (again, right click and choose save)

FileDialog fd = new FileDialog(new JFrame(),"Save PAX list",FileDialog.SAVE);

I cannot use new JFrame() (as I did above) because it might block the application.

For this I�m trying to get the root by:

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

And than:


FileDialog fd = new FileDialog myFrame,"Save PAX list",FileDialog.SAVE);

This get me a null frame :- (

Anyone?
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok I got it, i used Component invoker = popupMenu.getInvoker();
thank me
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> thank me

perhaps Dror Guzman might deserve a bit of credit?

http://forum.java.sun.com/thread.jspa?threadID=676077&tstart=0
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!