Tooltip Problem with Synth

H

Harri E

Hello,

i have a very strange behaviour with Tooltips in Synth. I created a
component extending JTextField using a own Tooltip. First time the
Tooltip appears there are no problems but from second time on i get an
Exception. To demonstrate the problem i created a very simple class
which containes all the necessary parts to demonstrate the behaviour.


public class MyToolTipField extends JTextField {
JToolTip tooltip = new JToolTip();


@Override
public JToolTip createToolTip() {
if(this.tooltip==null){
this.tooltip = new JToolTip();
}
return this.tooltip;
}

}



the Exception is:

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at
javax.swing.plaf.synth.SynthToolTipUI.getPreferredSize(SynthToolTipUI.java:139)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
at javax.swing.ToolTipManager.showTipWindow(ToolTipManager.java:233)
at
javax.swing.ToolTipManager$insideTimerAction.actionPerformed(ToolTipManager.java:655)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
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)
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at
javax.swing.plaf.synth.SynthToolTipUI.getPreferredSize(SynthToolTipUI.java:139)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
at javax.swing.ToolTipManager.showTipWindow(ToolTipManager.java:233)
at javax.swing.ToolTipManager.mouseMoved(ToolTipManager.java:591)
at
java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseMotionEvent(Component.java:5533)
at
javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3144)
at java.awt.Component.processEvent(Component.java:5257)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3905)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
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)



When i do not user Synth but e.g MetallLookAndFell i do not have these
Problems.

Has anyone a comparable Problem an maybe allready solved it?
Maybe the Problems is how i defined the Tooltip in my Synth-xml file?


<style id="tooltip" clone="default">
<insets top="1" left="5" bottom="1" right="5" />
<state>
<color idref="colorFormTextRegular" type="TEXT_FOREGROUND" />
<color idref="colorSelectTextBackground" type="BACKGROUND" />
</state>
</style>
<bind style="tooltip" type="region" key="ToolTip" />



Thanks for any help

Harri E.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top