Can I set a timer on a Java Swing JDialog box to close after a number of milliseconds

后端 未结 3 976
离开以前
离开以前 2020-12-09 20:01

Hi is it possible to create a Java Swing JDialog box (or an alternative Swing object type), that I can use to alert the user of a certain event and then automat

3条回答
  •  隐瞒了意图╮
    2020-12-09 20:54

    I would use a Swing Timer. When the Timer fires the code will be executed in the Event Dispatch Thread automatically and all updates to the GUI should be done in the EDT.

    Read the section from the Swing tutorial on How to Use Timers.

提交回复
热议问题