On Mon, 13 Feb 2023 19:31:56 GMT, Marius Hanl <mh...@openjdk.org> wrote:

> This PR adds the last missing method for dealing with nested event loops.
> As also written in the ticket, there is currently no (public) way to find out 
> whether it is safe to start an event loop now or not.
> Classes like `Dialog` check via 
> `Toolkit.getToolkit().canStartNestedEventLoop()` (sun api), if it safe to 
> start a nested event loop before doing so.

Do you have a use case?

The ticket only mentions: "The problem here is, that developers may wish to 
check this before calling showAndWait() but since the Toolkit is private sun 
api, it is not recommended to do so."

Why would they want to check this?  I mean, isn't it always a bug to call this 
at the wrong time and so would always need fixing, unless somehow that code can 
be called in multiple situations (from animation or from event handler for 
example).  Even then, if the code called is just a wrapper (to make Dialog use 
easier for example), then I think this wrapper should just pass on the 
`IllegalStateException` (and document it) as again, it is always a bug to call 
it at the wrong time.

I'm not against making it public, but have a hard time imagining situations 
where you'd want to check this and then **not** throw an exception anyway...

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

PR: https://git.openjdk.org/jfx/pull/1031

Reply via email to