ok i have made a custom component Block . The block starts a Timer which starts time . The Time class calls renderShape() method and that method calls repaint() .
At the paintComponent() i am changing the rotational angle by calling the rotate method . Now this is where the Rectangle should rotate .
Never put any kind of business logic in a painting method override. You have absolutely no control over when and how often a painting method executes.
There are no new questions, but there may be new answers.
Stephan van Hulst
Joined: Sep 20, 2010
It's because you rotate the graphical context by the same transformation, on every refresh. The graphical context is reset after a new call to paintComponent(). You need to use a variable to keep track of the total rotation so far.  And as Darryl has said, you need to do this outside the paintComponent() method. Change the rotation in your Time class, for example.
- Why are your class fields not private?
- Why aren't you using layout managers?
- Why is onefourth actually three fourths?