On Thu, 6 Jun 2024 05:11:41 GMT, Abhishek Kumar <[email protected]> wrote:
>> src/java.desktop/share/classes/javax/swing/table/JTableHeader.java line 1368:
>>
>>> 1366: try {
>>> 1367: parentLocation = parent.getLocationOnScreen();
>>> 1368: } catch (IllegalComponentStateException icse) {
>>
>> should we be preventing the exception by checking if the JTableHeader is
>> visible or not instead?
>
> As per the spec, getLocationOnScreen() API can throw ICSE and it should be
> right to catch this exception. Moreover, I tried checking with the
> JTableHeader's visibility, still got the ICSE while performing the testing.
> So, I think this should be an ideal way to handle.
That is very strange - the only reason getLocationOnScreen should throw ICSE is
when component is not showing on the screen. So if you ask parent.isShowing()
and it returns true but you still getting the exception - you need to
investigate what is going on, this is not a normal behavior.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19391#discussion_r1628913998