Java Swing JWindow application crash

后端 未结 2 1325
醉梦人生
醉梦人生 2020-12-31 06:20

If I use JDK1.8_40 or newer (Oracle or OpenJDK do the same), the following code together with a dialog resize will crash the application (tried Windows 7, x64, 64bit JDK)

相关标签:
2条回答
  • 2020-12-31 06:40

    Your Timer is not dispatching the Swing UI events on the Swing UI Thread. You need to "invokeLater" your runnable so it gets ran on the right thread.

    Alternatively, you could have the timer execute a SwingWorker, with the done() method posting the event (it is guaranteed to be on the event dispatch thread)

    0 讨论(0)
  • 2020-12-31 06:51

    A bit late with this answer, but the issue has been fixed.

    0 讨论(0)
提交回复
热议问题