help with rotate
hi,
im trying to rotate a rectangle,but when im doing so it not appear where the first 1 did here is my code pls tell me what is the problem and how can i rotate it and its center will b where the first one is,
thx.
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
publicclass ssextends JPanel{
publicvoid paint(Graphics g){
g.drawRect(100,100,100,100);
g.drawLine(140,90,140,110);
g.drawLine(160,90,160,110);
Graphics2D g2 = (Graphics2D) g;
g2.rotate(30.0 * Math.PI / 180.0);
g.drawRect(100,100,100,100);
// Draw a line (int x1, int y1, int x2, int y2)
g.drawLine(140,90,140,110);
g.drawLine(160,90,160,110);
}
publicstaticvoid main(String[] args){
JFrame frame =new JFrame();
frame.getContentPane().add(new ss());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);
}
}

