Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Image in JLabel

16 views
Skip to first unread message

focode

unread,
Sep 20, 2008, 12:52:28 AM9/20/08
to
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)

Mark Space

unread,
Sep 20, 2008, 1:39:00 AM9/20/08
to
focode wrote:

> 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>

0 new messages