• 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

Passing data from child JDialog to parent JFrame

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

I have a requirement to read details on a JDialog (called program) and then returning back to parent JFrame (calling program) so that details can be added to into a JTable (which is on JFrame) . Any help on how to pass data from JDialog to parent JFrame. I think making JTable "public static" is an option. However I would like to understand if any other better option can be drawn.

Thanks.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The usual way is to use one of the JOptionPane.showXXXDialog(), some of which return a value. Recommended reading http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
This would sit better on the GUI forums. Moving....
 
Sanjoo Singh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My data form is bit complex, so can not use JOptionPane.
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JOptionPane lends itself easily to complexity.
If you notice, the showInputDialog, in its many forms, accepts an Object message. You can leverage on this to create any complex UI container and pass it on to the message.

Does your requirement make it still impossible for you to useJOptionPane? If yes, maybe you can tell us why you think so and we can try and help you.
 
Marshal
Posts: 79180
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You ought not to pass information to the frame. You should be passing information via the frame to your application. The difference may appear slight, but it is actually very important.
 
reply
    Bookmark Topic Watch Topic
  • New Topic