• 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

Custom Password Dialog

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add a public method to the dialog which returns the array:
public String[] getLoginInformation() {
return loginInformation;
}
 
Brian Podolny
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
call the JDialog's dispose() method. (Inherited from awt.dialog)
 
I found a beautiful pie. And a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic