aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Passing data between JFrame & JDialog Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Passing data between JFrame & JDialog" Watch "Passing data between JFrame & JDialog" New topic
Author

Passing data between JFrame & JDialog

Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
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.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> 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

Joined: Mar 11, 2007
Posts: 78
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Passing data between JFrame & JDialog
 
Similar Threads
JDialog question
password masking & unmasking!!
How do I refresh the system time
Event Listeners
generate table data on button click