This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
The error is saying that you are trying to use a null reference to call a method, and it tells you exactly where that's happening. When I look at line 308, I do see that you are trying to call setText() on an object that you never initialize. However, I don't see where you initialize anything, so you should have hit an error much earlier. It's possible you initialize the fields outside the class since they are static and package private, which is one good reason not to structure your class like this. Fields should always be declared private, and statics should always be final. It's also possible that the line numbers in your listing aren't matching what you actually have.
Joined: Dec 01, 2012
I do know it's not getting any info so it's giving back a null,
But just wondering is it possible to work with static maps like the one above to have text fields in one class and the action listener for that class in a different class like what I am trying to do
Probably, but an example of what? Your problem is uninitialized variables, and I gave you an example of how to initialize variables already. Maybe you could post the code that it just didn't like ... not the whole class please, just a few lines. At the same time, you could be more specific about what you mean by "didn't like". Maybe post the error message you're getting?
Well, that's a step forward from a NullPointerException, right? Looking through your code, I can't really figure out what your application is meant to do. In your most recent posting, you are initializing text fields in the handler for a button press. That's an unusual thing to do. Every time you press that button, you'll get an entirely new set of text fields, so you aren't working with the ones you added to your frame, and so they won't render anywhere.
It really seems to me that you're being too ambitious here. You should start with small, easy applications until you get a feel for what you're doing. Try to implement basic features first, then add features as you get the old ones working reliably.
Joined: Dec 01, 2012
My program is doing the following
Connection to a database pull the data from the database to an array out put the array to the text fields
I have an edit save delete button,
I'm doing the whole static map thing off my own back I dont really need to do it but I just thought it would look nice if I can have the button actions in a different class away from the main, I did the same for the connection to the database I have that on a class of it's own along with the SQL querys it makes it easy to update code without having to scroll down 200+ lines