JFrame freezes during while loop [duplicate]

佐手、 提交于 2019-12-06 07:13:55

You're doing your time intense task in the event dispatch thread (EDT). This is a bad idea as the EDT also updates the UI. Therefore if this thread is blocked no update to the UI is done.

Castiblanco

The solution is to use threads, that's the reason because you're getting freeze, you're doing everything at the same time.

Please, look:

A thread can only do one thing at a time. So if you let it do calculations it will not update the gui. So you should use another thread. Also you will probably need to repaint your gui.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!