This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes NullPointerException thrown when generating SWING GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NullPointerException thrown when generating SWING GUI" Watch "NullPointerException thrown when generating SWING GUI" New topic

NullPointerException thrown when generating SWING GUI

Martin Dobie

Joined: May 21, 2003
Posts: 1
Hi there folks,
I am currently writing a small application that is used to demonstrate multi threading in a Swing-based interface application.
The Main method initialises an array of objects, a couple of DefaultListModels with another set of assigned objects.
I have then passed these parameters to an instance of another type of GUI class, generated by a simple new() GUIClass call, which incedentally initialises aand displays without exception.
When I try to genrate an instance of the same GUI class from a JButton event in the calling class, I have a NULLPOINTEREXCEPTION thrown. Signs presently indicate that it is being thrown by the parameters passed into the called GUI class.
I have become a little frustrated as I have been able to generate printlyn lists of the contents of the array, DefaultListModels from both the calling GUI class and the called GUI class.
I am at a loss presently and would appreciate some possible pointers, excuse the pun, to any possible solutions.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Martin,
Welcome to JavaRanch. Without seeing some code and the stack trace of the NPE, it's going tough for us to help out. Try posting some code and the stack trace.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: NullPointerException thrown when generating SWING GUI
It's not a secret anymore!