• 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

Question about some code of mine

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on an application where I have a frame with a menu bar. In a menu called File I have an open command that opens a file dialog box. This is how I coded it, I made a global object of the class and made it static so that I could pass that as the parent frame to the file dialog constructor. It just seems like it might not be the proper way to do it, any suggestions?
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom,
I think FileDialog should be made modal. If that is the case then you should use fd.show() instead of fd.setVisible( true ). This will block on the statement until the user has chosen a file or cancelled the dialog. Then you can just get the chosen file and call some local method in the calling class.
Regards,
Manfred.
 
reply
    Bookmark Topic Watch Topic
  • New Topic