Image in JLabel

F

focode

i am working on netbeans my problem is as follows ......in my jframe
i have introduced a JLabel and from the properties of JLabel i have
introduced a gif image , the program gets compiled well but it
generates following Exceptoins when i run the program , pls if anyone
can help me to get it done

thanks

init:
deps-jar:
compile-single:
run-single:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
at motion.motion.initComponents(motion.java:34)
at motion.motion.<init>(motion.java:17)
at motion.motion$1.run(motion.java:80)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
273)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
183)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
173)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:
121)
BUILD SUCCESSFUL (total time: 1 second)
 
M

Mark Space

focode said:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
at motion.motion.initComponents(motion.java:34)
at motion.motion.<init>(motion.java:17)

Well this doesn't tell us much, I think, except you had a null pointer
exception. It looks like it happened in the constructor of an object of
class "motion" in file "motion.java". In the initComponents() method,
you called ImageIcon with a null pointer (line 138, I think, check your
code).

You should use the debugger in NetBeans to find the problem.

If you need more help, some sample code would be needed. Make sure it's
a complete, compilable example or we won't be able to help you. Make
sure it's not too long, because no one is gong to read through some huge
program to debug it for you.

Here's what we need: SSCCE <http://www.pscode.org/sscce.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top