tags:

views:

65

answers:

2

Hi,

I have been working on a Swing based java program for a while now, today I have been editing the JComboBox (using Netbeans so I am unable to directly edit the code for it), at some point between edits the below errors have sudddenly appeared. Obviously at this point there is far too much code involved to post, but does anyone have any idea / experience of what may have caused this?

I have made no direct changes to the source code since before this error began, but despite all efforts to undo all changes made today it has made no impact on these errors. I have even tried closing netbeans and restarting it on the off chance that it was just playing up.

Also, what is the $1 at the end of Application indicating? I have not seen this previously

Thanks for any and all suggestions.

08-Oct-2010 14:07:07 org.jdesktop.application.Application$1 run

SEVERE: Application class nodeview.NodeViewApp failed to launch
java.lang.NullPointerException
        at nodeview.NodeViewView.<init>(NodeViewView.java:49)
        at nodeview.NodeViewApp.startup(NodeViewApp.java:19)
        at org.jdesktop.application.Application$1.run(Application.java:171)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "AWT-EventQueue-0" java.lang.Error: Application class nodeview.NodeViewApp failed to launch
        at org.jdesktop.application.Application$1.run(Application.java:177)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.NullPointerException
        at nodeview.NodeViewView.<init>(NodeViewView.java:49)
        at nodeview.NodeViewApp.startup(NodeViewApp.java:19)
        at org.jdesktop.application.Application$1.run(Application.java:171)
        ... 8 more

As requested, the code from line 37 through to 50 from NodeViewView

    messageTimer.setRepeats(false);
    int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
        busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
            statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
        }
    });
    idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
   statusAnimationLabel.setIcon(idleIcon); //49
   progressBar.setVisible(false); //50
A: 

You really need to look at the code for NodeViewView and NodeViewApp to figure this out. Please post the relevant sections out of these classes.

Edit: statusAnimationLabel is null then isn't it. Note that passing a null value to setIcon(Icon icon) won't throw a NPE.

Qwerky
A: 

NodeViewView.java:49 is where you will find the error. Most like an object has not been initialized properly and you're trying access a method or member variable of that object.

Nik
Thanks for all the replies. Using this I tracked down where idleIcon was initialised, it all appeared to be ok when I realised there was no call to actually initialise any of the swing code (all the code generated by Netbeans) and that was due to me clearly accidentally deleting the one line of; initComponents();Schoolboy error, but at least I found it! Thanks
Steve