I am getting the following exception when I am running my Swing Application. But the program continues and does not terminate abruptly unlike general Exceptions

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTreeUI.paintRow(BasicTreeUI.java:1399)
at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1189)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
at javax.swing.JComponent.paintComponent(JComponent.java:742)
at javax.swing.JComponent.paint(JComponent.java:1005)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4963)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916)
at javax.swing.JComponent._paintImmediately(JComponent.java:4859)
at javax.swing.JComponent.paintImmediately(JComponent.java:4666)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


How do I avoid this exception. What would be the cause for such an exception

This is part of the stack trace:
BasicTreeUI.paintRow(BasicTreeUI.java:1399)
It means that at the file BasicTreeUI.java, you have an Exception at line 1399 (function paintRow). You are trying to use something that is null.

This is part of the stack trace:
BasicTreeUI.paintRow(BasicTreeUI.java:1399)
It means that at the file BasicTreeUI.java, you have an Exception at line 1399 (function paintRow). You are trying to use something that is null.

Hi mate,
Yes From the stackTrace I got the point about BasicTreeUI being null. But the fact is its an internal code and I simply dont know why this is being Null. Its a Builtin java class which i did not touch

I cannot tell much without the code. But I know for sure that at the specific line there is something which is null and you use it

Hi,
This Exception is bcz an EventDispatch Thread runs in the java Background, try using swingWorker.invokeLater.

how to use swingWorker.invokeLater() method
please tell me i am getting the same error when iam passing track id and submitting it
its passed to a download method.....on submission
but i am getting "awt-eventqueue-0 null pointer exception"

This article has been dead for over six months. Start a new discussion instead.