Hi
Could someone have a look at my program I've attached and run it. It comes up with some error messages when compiling theres no red lines in the code though. I'm not 100% what the error messages are. any help would be appreciated.
Cheers
Dan
Printable View
Hi
Could someone have a look at my program I've attached and run it. It comes up with some error messages when compiling theres no red lines in the code though. I'm not 100% what the error messages are. any help would be appreciated.
Cheers
Dan
Post the error messages, and the code (in code tags) around where they are being raised.
Many people won't download stuff from forums.
Thats what comes up when I try to compile and run the program
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:167)
at finalpkg.gameScreen.<init>(gameScreen.java:28)
at finalpkg.gameScreen$7.run(gameScreen.java:226)
at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 597)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:122)
Crap I had this error on my final project and I'm trying to remember how to fix it. I would get this error in my calculator when I would try to press the = button. It has something to do with listeners on your button trying to access data elsewhere(in my case a BigInteger currentEntry) and manipulating it with other data.
Sorry if that's not much help. The NPE in your event queue has nothing in spot 0. I'm assuming you have a list and loop somewhere? Try changing the starting position to 1 instead.
Well, if you're getting a Null Pointer there then, looking at the ImageIcon code (since you haven't posted the relevant bit of yours), I'm guessing the URL handed to the constructor is null? Of course we might have different versions of Swing...so that might not be the right bit.
just debug stepwise you r trying to access null object somewhere....