Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
The following error occurs when i compile my code.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
at Frame1.initComponents(Frame1.java:438)
at Frame1.<init>(Frame1.java:30)
at Frame1$18.run(Frame1.java:710)
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:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)
BUILD SUCCESSFUL (total time: 1 second)
how do i debug it...?
Re: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Learn to write Swing code. The NetBeans visual designer isn't a beginners' tool.
db
Re: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Quote:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
Are you sure that the path/url to your image file is correct? Do you use the getResource method of the class object? Note that a leading slash indicates an absolute path (otherwise its relative to the package of the class!)