aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Custom Password Dialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Custom Password Dialog" Watch "Custom Password Dialog" New topic
Author

Custom Password Dialog

Brian Podolny
Ranch Hand

Joined: Aug 29, 2000
Posts: 32
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.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Add a public method to the dialog which returns the array:
public String[] getLoginInformation() {
return loginInformation;
}


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Brian Podolny
Ranch Hand

Joined: Aug 29, 2000
Posts: 32
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).]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
call the JDialog's dispose() method. (Inherited from awt.dialog)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom Password Dialog