Focusable ToolTips

I like how Eclipse has special tooltips that can be focused when you hover over them or click on them.  I knew this could be implemented in Swing because of the work I’m doing for the AutoComplete library.  While you normally don’t need to focus a tooltip, it can be useful in certain cases.  Scrolling through Javadoc in the little autocomplete documentation window in Eclipse, for example.  Another handy use is in Eclipse spell checking functionality – the tooltip provides links to correct the word, ignore it, add it to the dictionary, etc.

So I decided to see just what it would take to implement them.  At a minimum I could use the same functionality for the new, WIP  SpellChecker add-on.  I’m tentatively calling them “FocusableTips.”  Here are some screens of what I’ve cobbled up so far.  First, the tooltip before focusing:

A FocusableTip before focusing

A FocusableTip before focusing

And, after clicking on it, the resizable, interactive tip:

A FocusableTip after clicking on it

A FocusableTip after clicking on it

Note the tip is now resizable, you can select and copy text, click on links, etc.  It seems on Windows and Linux you can actually click on the links before the tooltip is focused, but on OS X this doesn’t seem possible.  MouseEvent behavior seems different on that platform for unfocused windows.  I’ll have to explore this a little more.

Comments are closed.