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 .
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?
subject: can't rotate ellipse after certain period of time