Results 1 to 4 of 4
  1. #1
    hemanthjava is offline Member
    Join Date
    Dec 2007
    Posts
    22
    Rep Power
    0

    Default Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    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(BasicT reeUI.java:1399)
    at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTree UI.java:1189)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.ja va:142)
    at javax.swing.JComponent.paintComponent(JComponent.j ava:742)
    at javax.swing.JComponent.paint(JComponent.java:1005)
    at javax.swing.JComponent.paintWithOffscreenBuffer(JC omponent.java:4963)
    at javax.swing.JComponent.paintDoubleBuffered(JCompon ent.java:4916)
    at javax.swing.JComponent._paintImmediately(JComponen t.java:4859)
    at javax.swing.JComponent.paintImmediately(JComponent .java:4666)
    at javax.swing.RepaintManager.paintDirtyRegions(Repai ntManager.java:451)
    at javax.swing.SystemEventQueueUtilities$ComponentWor kRequest.run(SystemEventQueueUtilities.java:114)
    at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 461)
    at java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:110)


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

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    At line 1399, you try to call a method of a null object. Check that line and test the objects there for nullness (e.g. if (myObj == null) {print("myObj is null");}. Once you find which object is null, try to fix that bug by analyzing why it is null and how you can solve ..

  3. #3
    hemanthjava is offline Member
    Join Date
    Dec 2007
    Posts
    22
    Rep Power
    0

    Default

    Quote Originally Posted by JavaBean View Post
    At line 1399, you try to call a method of a null object. Check that line and test the objects there for nullness (e.g. if (myObj == null) {print("myObj is null");}. Once you find which object is null, try to fix that bug by analyzing why it is null and how you can solve ..
    Hello JavaBean,
    But the class on which the method is invoked which results in a NullPointer is a Java Built-in Class. Hence I am not able to debug through the classes. When I do so I get lost in the never ending series of step walk-throughs

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Looks like the jvm tried to draw your JTree and found some null/corrupt data in the model. Check your tree model data.

Similar Threads

  1. Replies: 2
    Last Post: 12-14-2009, 01:46 AM
  2. Replies: 1
    Last Post: 08-06-2007, 06:04 PM
  3. Replies: 1
    Last Post: 07-31-2007, 01:54 PM
  4. Replies: 1
    Last Post: 07-25-2007, 10:55 PM
  5. Replies: 1
    Last Post: 07-16-2007, 06:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •