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 Beginning Java and the fly likes NullPtrException when reading JTextField 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 » Beginning Java
Bookmark "NullPtrException when reading JTextField" Watch "NullPtrException when reading JTextField" New topic
Author

NullPtrException when reading JTextField

Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
i have a jtextfield, and when i press a button, i should have a print that show me the value inserted in the textfield, but it doesnt run.

David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

recipeNameField is never created
Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
i create it there

Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
and i added another modifier

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11150
    
  16

do you really expect someone to go through your almost 600 lines of code? And as Dave said, you never create recipeNameField. The ONLY place I see it is on line 112 of your TbEvent class in the "public TbEvent(JButton t1, JTextField tf1, JComboBox tf2, JSlider tf3, JSpinner tf4, JSpinner tf5)" constructor...but it's never declared anywhere.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
looool i was tired, stupid error ty a lot
i solved
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Next time please limit your code to an SSCCE. With this amount of code I didn't even bother looking at it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPtrException when reading JTextField
 
Similar Threads
problem with insert and select
Jtable and database results
Dialogs
Desktop.Action.EMAIL
Problem with "abstract class