Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
- addMouseListener(new MouseAdapter() {
- public void mouseEntered(MouseEvent me) {
- ToolTipManager.sharedInstance().setDismissDelay(60000);
- }
- public void mouseExited(MouseEvent me) {
- ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
- }
- });
- private PopupFactory popupFactory = PopupFactory.getSharedInstance();
- private Popup popup;
- private JToolTip toolTip = jEditorPane.createToolTip();
- 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();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement