Timer in java using Eclipse

前端 未结 3 941
小蘑菇
小蘑菇 2021-01-21 15:37

I\'m trying to do a little program in Java using Eclipse, and I\'m a little bit lost.

Could anybody explain me (in a \"for dummies way\") what do I have to do for repain

3条回答
  •  轮回少年
    2021-01-21 15:57

    Why not use the timer functionality that is built into the SWT Display class?

    private void activateTimer(final Display display)
    {
        display.timerExec(
            1000,
            new Runnable() {
                public void run() {
                    whatever.redraw();
                    // If you want it to repeat:
                    display.timerExec(1000, this);
                }
            });
    }
    

提交回复
热议问题