On Sat, 27 Jan 2024 17:52:52 GMT, John Hendrikx <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/javafx/animation/Animation.java line
>> 1008:
>>
>>> 1006: if (parent != null) {
>>> 1007: throw new IllegalStateException("Cannot start when
>>> embedded in another animation");
>>> 1008: }
>>
>> Hm, this is going to look really ugly if the caller wasn't on the FX thread.
>> The exception won't be thrown, it seems to work, but once run on the FX
>> thread, it will just log this instead of breaking the callers flow.
>
> I suppose you can use this as a "trick" to test if the code to shunt it to
> the FX thread works (if you don't get the exception immediately, it worked...)
Perhaps a better solution is to move this (and similar) checks back to the
`play` method, add the checks to the `playFrom*` methods, and do the same for
`pause` and `stop`.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1352#discussion_r1468543769