i am drawing two rect in paint method. 1st rect i want to rotate it but 2nd rect i dont want to rotate it. the code i have should rotate only 1st rect but the problem is that when it rotate it missup the x, y postion of rect. this might has to do with translate but not sure. how can i fix tis?
///paint method Graphics2D g2d = (Graphics2D) g; AffineTransform saveAT = g2d.getTransform(); g2d.translate(x+(width/2), y+(height/2)); g2d.setTransform(saveAT); g2d.rotate(Math.PI/4); g.drawRect(...); //rotate this rect g2d.setTransform(saveAT); //rotate back? g.drawRect(...); //dont rotate this rect