|
This is normal behaviour for Java GUI programs. The main program keeps on going, as you say, while the GUI runs in a separate thread called the "event thread". Normally you don't notice this because the main program starts the GUI and then does nothing else, leaving the GUI the only active thread. If you called "Authenticator a = new MyAuthenticator()" in the event thread (e.g. in response to a button click or some other GUI event), and if your JDialog was a modal dialog, then you would have to key in your information before "Authenticator.setDefault(a)" would be called. PC2 -----Original Message----- From: java400-l-bounces+pclapham=core-mark.com@xxxxxxxxxxxx [mailto:java400-l-bounces+pclapham=core-mark.com@xxxxxxxxxxxx] On Behalf Of Larry Sent: March 17, 2005 05:56 To: java400-l@xxxxxxxxxxxx Subject: Authenticator Question I wrote a small authenticator class. It is designed to pop up a window, allow the user to type in their information and return a PasswordAuthentication object. To do this when the authenticator is created, in the constructor I pop up the window. public MyAuthenticator() { super(); getJDialog(); JDialog.show(); In my button on the window I take the values and move them to strings which get sent back in the protected PasswordAuthentication getPasswordAuthentication() method which consists simply of return (new PasswordAuthentication (uname,pass.toCharArray())). In my main program that uses the authenticator I do the following: ........ Authenticator a = new MyAuthenticator(); Authenticator.setDefault(a); ........ When I run this code, the window pops up in the Authenticator class, but the main program seems to keep chugging along - not waiting for my data entry into the window. The window itself works fine, but the main program just seems to not want to wait for the data coming back from it. I know the authenticator class works fine other than the GUI. If I supress the GUI and just force in a user name and password, everything runs fine. When I put in the GUI, it does not. Any ideas where I may be going wrong? Larry _______________________________________________ No banners. No pop-ups. No kidding. Make My Way your home on the Web - http://www.myway.com -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.