|
1 | 1 | /* |
2 | | - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -265,13 +265,19 @@ void showTipWindow() { |
265 | 265 | toFind = new Point(screenLocation.x + preferredLocation.x, |
266 | 266 | screenLocation.y + preferredLocation.y); |
267 | 267 | } else { |
268 | | - toFind = mouseEvent.getLocationOnScreen(); |
| 268 | + if (mouseEvent != null) { |
| 269 | + toFind = mouseEvent.getLocationOnScreen(); |
| 270 | + } else { |
| 271 | + toFind = screenLocation; |
| 272 | + } |
269 | 273 | } |
270 | 274 |
|
271 | 275 | GraphicsConfiguration gc = getDrawingGC(toFind); |
272 | 276 | if (gc == null) { |
273 | | - toFind = mouseEvent.getLocationOnScreen(); |
274 | | - gc = getDrawingGC(toFind); |
| 277 | + if (mouseEvent != null) { |
| 278 | + toFind = mouseEvent.getLocationOnScreen(); |
| 279 | + gc = getDrawingGC(toFind); |
| 280 | + } |
275 | 281 | if (gc == null) { |
276 | 282 | gc = insideComponent.getGraphicsConfiguration(); |
277 | 283 | } |
@@ -301,8 +307,12 @@ void showTipWindow() { |
301 | 307 | location.x -= size.width; |
302 | 308 | } |
303 | 309 | } else { |
304 | | - location = new Point(screenLocation.x + mouseEvent.getX(), |
305 | | - screenLocation.y + mouseEvent.getY() + 20); |
| 310 | + if (mouseEvent != null) { |
| 311 | + location = new Point(screenLocation.x + mouseEvent.getX(), |
| 312 | + screenLocation.y + mouseEvent.getY() + 20); |
| 313 | + } else { |
| 314 | + location = screenLocation; |
| 315 | + } |
306 | 316 | if (!leftToRight) { |
307 | 317 | if(location.x - size.width>=0) { |
308 | 318 | location.x -= size.width; |
|
0 commit comments