Set dynamic JLabel text in a JDialog by timer

后端 未结 4 843
终归单人心
终归单人心 2020-12-21 18:10

Im trying to make a JDialog that will show the user a dynamic message on a JLabel. The message should be a count from 1 to 10 (and it should be changing a number every secon

4条回答
  •  滥情空心
    2020-12-21 19:05

    • don't use Thread.sleep(int) for Swing GUI, caused freeze of untill Thread.sleep(int) ended

    • use Swing Timer instead of locking Swing GUI by usage of Thread.sleep(int)

    • don't use dia.setSize(300, 150), learn how LayoutManager works

提交回复
热议问题