- Timestamp:
- 2016-03-21T01:00:06+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r9977 r10024 136 136 final SourceEntryListCellRenderer listCellRenderer = new SourceEntryListCellRenderer(); 137 137 this.lstAvailableSources.setCellRenderer(listCellRenderer); 138 GuiHelper.extendTooltipDelay(lstAvailableSources); 138 139 this.availableSourcesUrl = availableSourcesUrl; 139 140 this.sourceProviders = sourceProviders; -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r9916 r10024 24 24 import java.awt.event.HierarchyListener; 25 25 import java.awt.event.KeyEvent; 26 import java.awt.event.MouseAdapter; 27 import java.awt.event.MouseEvent; 26 28 import java.awt.image.FilteredImageSource; 27 29 import java.lang.reflect.InvocationTargetException; … … 43 45 import javax.swing.SwingUtilities; 44 46 import javax.swing.Timer; 47 import javax.swing.ToolTipManager; 45 48 import javax.swing.UIManager; 46 49 import javax.swing.plaf.FontUIResource; … … 475 478 return e != null && e.getSource() instanceof Component ? SwingUtilities.getWindowAncestor((Component) e.getSource()) : null; 476 479 } 480 481 /** 482 * Extends tooltip dismiss delay to a default value of 1 minute for the given component. 483 * @param c component 484 * @since 10024 485 */ 486 public static void extendTooltipDelay(Component c) { 487 extendTooltipDelay(c, 60000); 488 } 489 490 /** 491 * Extends tooltip dismiss delay to the specified value for the given component. 492 * @param c component 493 * @param delay tooltip dismiss delay in milliseconds 494 * @see <a href="http://stackoverflow.com/a/6517902/2257172">http://stackoverflow.com/a/6517902/2257172</a> 495 * @since 10024 496 */ 497 public static void extendTooltipDelay(Component c, final int delay) { 498 final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay(); 499 c.addMouseListener(new MouseAdapter() { 500 @Override 501 public void mouseEntered(MouseEvent me) { 502 ToolTipManager.sharedInstance().setDismissDelay(delay); 503 } 504 505 @Override 506 public void mouseExited(MouseEvent me) { 507 ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout); 508 } 509 }); 510 } 477 511 }
Note:
See TracChangeset
for help on using the changeset viewer.