Java swing JMenuBar sometimes doesn't show up

前端 未结 1 707
一整个雨季
一整个雨季 2021-01-23 08:56

I am working on a Java desktop application, and sometimes my jmenubar shows up, sometimes it doesn\'t. When it doesn\'t the entire program freezes and I have to kill it.

<
相关标签:
1条回答
  • 2021-01-23 09:14

    The essential rules are these:

    1. Verify that all GUI elements are constructed on the event dispatch thread.

    2. Verify that no exceptions are swallowed, especially on the event dispatch thread.

    Note that the EDT will restart itself after an exception is thrown. Depending on the circumstances, the application may appear to freeze. Although you should see something on the console, the article Uncaught Exception Handlers may offer some insight.

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