Non-blocking modal Swing progress dialog

前端 未结 2 1590
梦如初夏
梦如初夏 2020-12-31 05:02

A daft question, but I really cannot get this to work: I have some long-running process in a Swing application which may take several minutes. I want to display a progress d

2条回答
  •  情话喂你
    2020-12-31 05:44

    You should be using the GlassPane from preventing the user from interacting. The good thing is this is modal for the user and not your program so your thread won't get blocked.

    The great news is that you can also use it for cool GUI effects like shading the GUI portion busy and the user can't interact with. You can also display a busy gif image in the GlassPane.

    Links:-

    1. Official tutorial on GlassPane
    2. Some helpful tutorials
    3. Another tut
    4. Oreilly's Swing Hacks is excellent.

提交回复
热议问题