tags:

views:

327

answers:

1

Is it possible to change the tooltip delay in SWT? In Swing, I would normally use the methods in Tooltip.sharedInstance(). This seems to break in SWT.

+1  A: 

No, not as far as I know. The tooltips are tightly coupled to the tooltips of the underlying native system, so you're stuck with their behaviour.

But there is another way, you would have to implement the tooltips yourself. With that approach you can create very complex tooltips.

class TooltipHandler {
    Shell tipShell;

    public TooltipHandler( Shell parent ) {
        tipShell = new Shell( parent, SWT.TOOL | SWT.ON_TOP );

        <your components>

        tipShell.pack();
        tipShell.setVisible( false );
    }

    public void showTooltip( int x, int y ) {
        tipShell.setLocation( x, y );
        tipShell.setVisible( true );
    }

    public void hideTooltip() {
        tipShell.setVisible( false );
    }
}
derBiggi