I have a small panel where i am making a ball to move by just varying it's x co-ordinate
.
I want the ball move back when it encounters the end of frame.The width of my frame is 300
(by fr.setSize(300,300))
.
Now I programmed the animation like :
// when x == 300
// stop the timer
But x=300 seems to be greater than it's width which is 300 ! How is this possible.
**The ball moves out of the 300 x 300
frame and becomes invisible.
Why is this happening ?
These are the screen shots of what happens eventually.
First snapshot is that of the moving ball,second shows that ball has disappeared,third shows on enlarging that ball is there.
Why this happens.? How can i set the frame's end point as the ball's end point?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…