Hi,
I'm new to this forum and javafx.
I'm very experienced in java, swing (plus I used to design JVM's in a past life for embedded systems.including mobile).
Are there restrictions on when the JFX application is allowed to acquire a graphics context and do drawing on a canvas? (swing provides repaint() to schedule graphics activity by the app). Must this always be initated via a UI control event handler? In general, I wantr to draw on a Canvas in response to many different triggers, including UI control based.
I have been trying some home-made animation on the JFX App thread, with interesting results.
If I use an AnimationTimer, and draw from within its callback, all is fine.
Before I discovered this, I intiially tried by own hack, with a short loop involving sleep() for 50 ms, then drawing. This loop triggered in response to a Button event handler. So, we're all still in the context of the App thread. This didn't work ... the canvas layout screwed up, and no graphics appeared within it.
So, please can you answer 2 questions.
1/ are there restrictions to be honoured, and if so, where can I find these documented? I've spent a long time searching the oracle site, with no luck. For the real product I am developing, I especially need to know if there are issues with another thread sending requests to the App thread, to do some work which eventually leads to graphics.
2/ the observed behaviour above may imply livelock is occurring (somehow starving the thread of the ability to complete its operations), or there are behind the scenes thread synchronisation going on that I managed to disrupt. I've only seen very high level mention of threading for the JFX architecture. Is there any in-depth explanation available please?
Many thanks,
Jerry Kramskoy