+ 3

Running multiple methods at the same time in java fx

HI I AM LEARNING JAVAFX AND I AM USING SCENEBUILDER. IN MY GAME I NEED TO LOCATE THE POSITION Of the BALL AT ALL TIMES HOWEVER THIS REQUIRE MULTIPLE METHODS RUNNING SIMULTANEOUSLY. I KNOW THAT USING THREADS DO THIS BUT I AM THINK I AM USING THEM WRONG. THE PROBLEM COULD ALSO BE WITH THE BALL.CENTERYPROPERTY.GETVALUE METHOD. IT IS CONFUSING AS IT APPEARS THAT THE BALL.GETY RETURNS A DIFFERENT VALUE TO BALL.CENTERYPROPERTY. PLS HELP. I AM STILL LEARNING SO MY CODE IS NOT THE NEATEST. SORRY ABOUT THE CAPS MY KEYBOARD IS GLITCHING 😐 THIS IS MY JAVAFX CONTROLLER CODE AND MAIN CLASS https://code.sololearn.com/c9CEhyUMfj96/?ref=app THIS IS MY FXML CODE https://code.sololearn.com/WDEwdR41KaL4/?ref=app

11th May 2020, 4:38 PM
Stephen
1 ответ
+ 2
The problem is the two stages never update simultaneously. I think they both are using the same javafx Application thread in Platform.runLater.
12th May 2020, 5:31 AM
Divya Peddapalyam
Divya Peddapalyam - avatar