Skip to content

Commit 054362a

Browse files
author
Abhishek Kumar
committed
8332550: [macos] Voice Over: java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
Reviewed-by: asemenov, kizune, achung
1 parent 9b436d0 commit 054362a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/java.desktop/share/classes/javax/swing/table/JTableHeader.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1360,9 +1360,12 @@ public boolean contains(Point p) {
13601360
}
13611361

13621362
public Point getLocationOnScreen() {
1363-
if (parent != null) {
1363+
if (parent != null && parent.isShowing()) {
13641364
Point parentLocation = parent.getLocationOnScreen();
13651365
Point componentLocation = getLocation();
1366+
if (parentLocation == null || componentLocation == null) {
1367+
return null;
1368+
}
13661369
componentLocation.translate(parentLocation.x, parentLocation.y);
13671370
return componentLocation;
13681371
} else {

0 commit comments

Comments
 (0)