This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm trying to write a class that is a custom JDialog. It has a JTextField for a Username, JPasswordField, and then a third JTextField which is labled in the constructor. The purpose of the dialog is to enable users to log on to a domain, database, etc. I included a getInput method which returns an array of Strings with the inputs. How can I get the parent frame to grab the string array from the JDialog? Also, what code do I need to write to close the JDialog? I've worked with frames and know how to write a WindowListener for the closing, but how can I make the window close itself when the user clicks on an "enter" button( in the JDialog ) and still get the parent app to grab the information. Thanks for whatever help you can give me.
Thanks for the response Thomas. What I mean is, how can I register an actionListener such that when a button is pressed on the Jdialog, it passes the string, and then the JDialog is closed and destroyed. I've already included a getInput method( the same as what you mentioned above) in the JDialog that returns the String. I guess I could just register an ActionListener with a button that sets the String in the parent class, but I still don't know how to force the closing of the JDialog.
[This message has been edited by Brian Podolny (edited October 13, 2000).]
Joined: May 05, 2000
call the JDialog's dispose() method. (Inherited from awt.dialog)