Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. private final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
  2.  
  3. addMouseListener(new MouseAdapter() {
  4.  
  5. public void mouseEntered(MouseEvent me) {
  6. ToolTipManager.sharedInstance().setDismissDelay(60000);
  7. }
  8.  
  9. public void mouseExited(MouseEvent me) {
  10. ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
  11. }
  12. });
  13.  
  14. private PopupFactory popupFactory = PopupFactory.getSharedInstance();
  15. private Popup popup;
  16. private JToolTip toolTip = jEditorPane.createToolTip();
  17.  
  18. private void showToolTip(MouseEvent e) {
  19. toolTip.setTipText(...);
  20. int x = e.getXOnScreen();
  21. int y = e.getYOnScreen();
  22. popup = popupFactory.getPopup(jEditorPane, toolTip, x, y);
  23. popup.show();
  24. }
  25.  
  26. private void hideToolTip() {
  27. if (popup != null)
  28. popup.hide();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement