why my code “Bouncing ball” doesn't work?

后端 未结 3 834
南方客
南方客 2020-12-11 14:15

I\'m trying to write a code a bout a bouncing ball, but i\'m stuck in how to make the ball bounced. The code seems correct, no wrong messages from eclipse and yet the ball d

3条回答
  •  死守一世寂寞
    2020-12-11 14:56

    private Timer timer = new Timer(20, new TimerListener());
    

    doesn't that new TimerListener() need to do something useful? shouldn't most of the code inside StartBouncingBallTest be happening every time the timer ticks, intsead of just once when the timer starts?

提交回复
热议问题