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.
|
---|
2 | package org.openstreetmap.josm.gui;
|
---|
3 |
|
---|
4 | import java.awt.Graphics;
|
---|
5 |
|
---|
6 | import javax.swing.JComponent;
|
---|
7 | import javax.swing.plaf.ComponentUI;
|
---|
8 | import javax.swing.plaf.metal.MetalToolTipUI;
|
---|
9 |
|
---|
10 | import 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 | */
|
---|
16 | public 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.