aspose file tools
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

Tooltip Null Pointer

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 191

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(
at javax.swing.ToolTipManager.mouseMoved(
at java.awt.AWTEventMulticaster.mouseMoved(
at java.awt.Component.processMouseMotionEvent(
at javax.swing.JComponent.processMouseMotionEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$000(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(
Rob Spoor

Joined: Oct 27, 2005
Posts: 19905

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.

How To Ask Questions How To Answer Questions
jQuery in Action, 2nd edition
subject: Tooltip Null Pointer