taoujouti / macwidgets

Automatically exported from code.google.com/p/macwidgets
0 stars 0 forks source link

SourceList and tool tip text: NullPointerException #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello!
I just tried to use the new SourceListToolTipProvider. It works fine but a 
NullPointerException is thrown when the 
mouse pointer is moved on the empty space of the SourceList (see attached 
image).

This is the stack trace:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.explodingpixels.macwidgets.SourceList$CustomJTree.getToolTipText(SourceList.java:661)
    at javax.swing.ToolTipManager.mouseMoved(ToolTipManager.java:594)
    at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:313)
    at java.awt.Component.processMouseMotionEvent(Component.java:6346)
    at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3283)
    at java.awt.Component.processEvent(Component.java:6070)
    at java.awt.Container.processEvent(Container.java:2085)
    at java.awt.Component.dispatchEventImpl(Component.java:4667)
    at java.awt.Container.dispatchEventImpl(Container.java:2143)
    at java.awt.Component.dispatchEvent(Component.java:4497)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4600)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4277)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4194)
    at java.awt.Container.dispatchEventImpl(Container.java:2129)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4497)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

..and this is my implementation of SourceListToolTipProvider:

mySourceList.setToolTipProvider(new SourceListToolTipProvider() {
    public String getTooltip(SourceListItem sourceListItem) {
        return sourceListItem.getText();
    }

    public String getTooltip(SourceListCategory sourceListCategory) {
        return sourceListCategory.getText();
    }
});

Original issue reported on code.google.com by alex.co...@gmail.com on 24 Aug 2009 at 9:18

Attachments:

GoogleCodeExporter commented 9 years ago
Added check for null when calculating tooltip.

Original comment by kenneth....@gmail.com on 24 Aug 2009 at 11:07