GUI update with threads error

前端 未结 2 1882
抹茶落季
抹茶落季 2021-01-26 06:34

I make board game in javafx and I stumbled upon a problem. My application has Client/Server connection. Whenever server sends data about where player moved his pawn I call a fun

2条回答
  •  既然无缘
    2021-01-26 07:08

    One of your other classes seems to start a thread, which is not controlled by your fx application thread. Hard to tell, which one without seeing the other classes.

    Please have a look at what to consider when using background threads in a java fx application (or when using libaries, that do so), e.g. how to use Task and Platform.runLater(Runnable r). There are countless other questions about that topic on SO, that might help you.

    https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/concurrency.htm

提交回复
热议问题