I fixed it. First, I observed that the rotation increment in keylistener was slower than the rotation increment in the timer. So, I created a boolean flag that sets to true if the key is pressed and false if the key is released. Then, I do the rotation of the first image in the timer. If the boolean flag is true, then the first image rotates as long as the boolean flag is true and stop if false. I only apply my solution on the right rotation, though, it can be easily applied on the left rotation. This solution is not that elegant though. Is there another alternative to this solution like a mathematical formula that produces the same result?