Is it a bad practice to use self made threads for a javaFX game loop instead of using AnimationTimer ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is it a bad practice to use self made threads for a javaFX game loop instead of using AnimationTimer ?

Most people use self made threads for swing but in javaFX they use AnimationTimer. Why is that so ? Will there be any performance issues if I use self made threads for a game loop in javaFX instead of using AnimationTimer ?

31st Dec 2021, 6:00 PM
darkorbit17493
darkorbit17493 - avatar
4 Answers
+ 2
Hello darkorbit17493 The way I see it, you had to build your own threads because there was no other option for swing. I don't think there will be any difference in performance, but you will certainly save work if you use AnimationTimer.
3rd Jan 2022, 3:13 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
darkorbit17493 Sorry 😂 But there is not much material about your topic. This article seems to be interesting: https://netopyr.com/2012/06/14/using-the-javafx-animationtimer/ You can use AnimationTimer also for other stuff, not only for animations. I think it is worth taking a closer look at this class.
3rd Jan 2022, 5:39 PM
Denise Roßberg
Denise Roßberg - avatar
0
That's my thread in stack overflow XD
3rd Jan 2022, 3:24 PM
darkorbit17493
darkorbit17493 - avatar