RFR: 8332550: [macos] Voice Over: java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location [v2]

Abhishek Kumar abhiscxk at openjdk.org
Thu Jun 6 08:47:44 UTC 2024


On Thu, 6 Jun 2024 07:28:59 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

>> 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.

Actually I was checking visibility with `parent.isVisible()` and this is always `true` but I was getting exception for getLocationOnScreen method. 
But when checked with `parent.isShowing()` then it behaves correctly, whenever it returns `false`, there is no exception as it doesn't go inside condition and when it returns `true`, `getLocationOnScreen` works as expected.

So, I guess `parent.isShowing` check should be sufficient to handle the exception.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19391#discussion_r1629036998


More information about the client-libs-dev mailing list