How to keep a method running continuously in background until the program ends?

后端 未结 2 548
Happy的楠姐
Happy的楠姐 2021-01-03 14:21

I want to know, how to keep a method running in the background. ie. this method starts when the program starts and keeps executing its statements until the program is closed

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-03 14:53

    "SWING isn't thread safe" as you may have seen in may of the Java Docs.

    Best way is to use a SwingWorker class. It provides functionality for calculation of results or performance of tasks that have long execution times.

提交回复
热议问题