This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes NullPointerException with JTextField.getText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "NullPointerException with JTextField.getText" Watch "NullPointerException with JTextField.getText" New topic
Author

NullPointerException with JTextField.getText

Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 231
    
    1

For some reason, a NullPointerException is thrown in the saveInfo() method which tries to save the text from the text fields once the sign in button is clicked.

Here are my two files:



Main method:
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Line 51 to 53, you're shadowing your instance variables with local variables.


[My Blog]
All roads lead to JavaRanch
Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 231
    
    1

Thanks a lot sir! Silly mistake on my part
 
 
subject: NullPointerException with JTextField.getText
 
Similar Threads
Sending password/login info using sockets
Creating a login screen
My second frame will not open and my first will not close
What is wrong with my code?
My code does not run