• 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 between JFrame & JDialog

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

Here's the situation and what I've done so far - I have a JFrame in my program, which is instantiating a JDialog. Each of the two contain a JTextField. When I type in the JDialog's JTextField and press Enter, its text should be passed to JFrame's JTextField. I have tried to solve this in 2 ways. The code that I've written is as follows -



I basically want to wait on JDialog's input before doing further processing. Could someone please advice me as to which one of the above ways is ok? These 2 are the ones I've done so far. Any other ways/suggestions are highly appreciated.

Thanks in advance.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> When I type in the JDialog's JTextField and press Enter, its text should be passed to JFrame's JTextField.

if you set both textfields to share the same document, no need to press enter
 
Roshni Singhania
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I didn't know much about the document of the textfield. So I looked it up after reading your reply. It solved my problem. Thanks you very much. You helped a lot.



Originally posted by Michael Dunn:
> When I type in the JDialog's JTextField and press Enter, its text should be passed to JFrame's JTextField.

if you set both textfields to share the same document, no need to press enter

 
reply
    Bookmark Topic Watch Topic
  • New Topic