*
The moose likes Swing / AWT / SWT and the fly likes Tooltip Null Pointer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Tooltip Null Pointer" Watch "Tooltip Null Pointer" New topic
Author

Tooltip Null Pointer

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

This exception thrown is what I get ' occasionally ' when the mouse is passed over my JTable. I have tried testing every which way for a null pointer with the method below and cannot find what it is. The second method was added recently but the exception has nothing to do with it - (exception was thrown before this addition) See exception code further down.







Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at film_titles.table.Table.getToolTipText(Unknown Source)
at javax.swing.ToolTipManager.checkForTipChange(ToolTipManager.java:589)
at javax.swing.ToolTipManager.mouseMoved(ToolTipManager.java:561)
at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:330)
at java.awt.Component.processMouseMotionEvent(Component.java:6549)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3339)
at java.awt.Component.processEvent(Component.java:6273)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4860)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4505)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2713)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

The exception is thrown directly from your own getToolTipText method. That means that inside that method, a null reference is dereferenced. Since neither e nor this will be null, that leaves two culprits (assuming the MyPreferences.getInt method is static):
1) ob is null when calling toString() on it.
2) data is null when calling toString() on it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Tooltip Null Pointer
 
Similar Threads
NoClassDefFoundError(unable to open projects)
problem clicking jbuttons in jtable
Getting 'null' value in response to statement.executeUpdate method
Problem reading database.
null pointer