RFR: JDK-8302355: Public API for Toolkit.canStartNestedEventLoop()
Marius Hanl
mhanl at openjdk.org
Tue Feb 14 11:46:57 UTC 2023
On Tue, 14 Feb 2023 09:54:19 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
> Okay, I found the use case you had, apparently you want to be able to show dialogs from an uncaught exception handler which could trigger when an exception occurs during layout. When it returns `false` you use `Platform.runLater`, but what's the reason you don't always use `Platform.runLater` to show the dialog?
I'm not in favor of always using `Platform.runLater`, just only when needed. And in this use case it is not needed 99% of the time.
Another use case is when showing a `Dialog` in a `Timeline` `Keyframe`. Since a `Timeline` is executed while still in `pulse`, the same exception happens. And in my case I have many utility methods for creating `Dialog`s, which normally just work. But in this case we will get an exception and we can just use private API or `try-catch` to get around that. Always using `Platform.runLater`, as written above, does not feel like a good solution. And sometimes one can actually see a small delay.
-------------
PR: https://git.openjdk.org/jfx/pull/1031
More information about the openjfx-dev
mailing list