source: josm/trunk/src/org/openstreetmap/josm/gui/JosmMetalToolTipUI.java

Last change on this file was 17682, checked in by Don-vip, 3 years ago

fix #19585 - fix workaround to JDK-8262085

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui;
3
4import java.awt.Graphics;
5
6import javax.swing.JComponent;
7import javax.swing.plaf.ComponentUI;
8import javax.swing.plaf.metal.MetalToolTipUI;
9
10import org.openstreetmap.josm.tools.Logging;
11
12/**
13 * Overrides MetalToolTipUI to workaround <a href="https://bugs.openjdk.java.net/browse/JDK-8262085">JDK-8262085</a>
14 * @since 17681
15 */
16public class JosmMetalToolTipUI extends MetalToolTipUI {
17
18 static final JosmMetalToolTipUI sharedInstance = new JosmMetalToolTipUI();
19
20 /**
21 * Returns an instance of the {@code JosmMetalToolTipUI}.
22 *
23 * @param c a component
24 * @return an instance of the {@code JosmMetalToolTipUI}.
25 */
26 public static ComponentUI createUI(JComponent c) {
27 return sharedInstance;
28 }
29
30 @Override
31 public void paint(Graphics g, JComponent c) {
32 try {
33 super.paint(g, c);
34 } catch (IllegalArgumentException e) {
35 if ("Width and height must be >= 0".equals(e.getMessage())) {
36 Logging.debug(e);
37 } else {
38 throw e;
39 }
40 }
41 }
42}
Note: See TracBrowser for help on using the repository browser.