Hi I am trying to learn Java swing and I wanted to draw a rectangle that will move in a random direction but when it collides with a wall it should change a direction of its movement.
So I have this code:
but it stops after the first time when it is done and it moves so quickly that I cannot see the movement.
I have another code it works perfectly fine I just don't understand why the first code doesn't work when I used the same logic but tried to do it more complicated
here is my second code
Can someone help thanks in advance
Everybody's invited. Except this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads