Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Strange Problem, JTextField.getText() not working

843806Jun 13 2007 — edited Jun 14 2007
Hey folks, I have a JApplet I am working on, building it in Netbeans 5.5.1. I am using the following Swing components for part of the applet:

JTextField jUsernameTextField
JTextField jPasswordTextField
JButton jLoginButton

Here is part of my button release handler:

private void jLoginButtonMouseReleased(java.awt.event.MouseEvent evt) {

System.out.println( "user=(" + jUsernameTextField.getText() + ") pass=(" + jPasswordTextField.getText() + ")" );

}

In the Netbeans IDE when I do a test compile/run it works fine, the username and password are retrieved from the components getText() methods -- when I use the appletviewer that came with my Java install ( jdk1.6.0_01 ) or load the applet via Firefox or MSIE the two textfield getText() methods return an empty string - no exceptions are thrown, nothing in the Java Console to point me to what might be wrong.

Any help would be greatly appreciated, not sure what to look into.

Thanks!
-Andy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 12 2007
Added on Jun 13 2007
5 comments
926 views