I\'m trying to set tooltips on a JEditorPane. The method which I use to determine what tooltip text to show is fairly CPU intensive - and so I would like to onl
You can show the popup yourself. Listen for mouseMoved() events, start/stop the timer and then show popup with the following code:
First you need PopupFactory, Popup, and ToolTip:
private PopupFactory popupFactory = PopupFactory.getSharedInstance();
private Popup popup;
private JToolTip toolTip = jEditorPane.createToolTip();
then, to show or hide the toolTip:
private void showToolTip(MouseEvent e) {
toolTip.setTipText(...);
int x = e.getXOnScreen();
int y = e.getYOnScreen();
popup = popupFactory.getPopup(jEditorPane, toolTip, x, y);
popup.show();
}
private void hideToolTip() {
if (popup != null)
popup.hide();
}
This will give you adjustable delay and a lot of troubles :)