8332431: NullPointerException in JTable of SwingSet2

Reviewed-by: abhiscxk, kizune
This commit is contained in:
Prasanta Sadhukhan 2024-05-29 05:09:39 +00:00
parent 01060ad4ab
commit 9a83dfee14

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -265,13 +265,19 @@ public final class ToolTipManager extends MouseAdapter implements MouseMotionLis
toFind = new Point(screenLocation.x + preferredLocation.x,
screenLocation.y + preferredLocation.y);
} else {
toFind = mouseEvent.getLocationOnScreen();
if (mouseEvent != null) {
toFind = mouseEvent.getLocationOnScreen();
} else {
toFind = screenLocation;
}
}
GraphicsConfiguration gc = getDrawingGC(toFind);
if (gc == null) {
toFind = mouseEvent.getLocationOnScreen();
gc = getDrawingGC(toFind);
if (mouseEvent != null) {
toFind = mouseEvent.getLocationOnScreen();
gc = getDrawingGC(toFind);
}
if (gc == null) {
gc = insideComponent.getGraphicsConfiguration();
}
@ -301,8 +307,12 @@ public final class ToolTipManager extends MouseAdapter implements MouseMotionLis
location.x -= size.width;
}
} else {
location = new Point(screenLocation.x + mouseEvent.getX(),
screenLocation.y + mouseEvent.getY() + 20);
if (mouseEvent != null) {
location = new Point(screenLocation.x + mouseEvent.getX(),
screenLocation.y + mouseEvent.getY() + 20);
} else {
location = screenLocation;
}
if (!leftToRight) {
if(location.x - size.width>=0) {
location.x -= size.width;