This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler 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 Customer Requirements for Developers this week in the Jobs Discussion 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: 245
    
    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: 14688
    
  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: 245
    
    1

Thanks a lot sir! Silly mistake on my part
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: NullPointerException with JTextField.getText
 
jQuery in Action, 3rd edition