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.