When I add the function g2d.rotate(some Number)
the screen shows no shape at all, and without this function everything is working.
What is the problem?
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(color);
Polygon polygon = new Polygon(xCordinate,yCordinate,4);
// g2d.rotate(Math.toRadians(45));
g2d.draw(polygon);
g2d.fill(polygon);
}
and in the main:
public class Main extends JPanel {
Camera c=new Camera(100, 50, (Math.PI)*2, 0, 150,200,Math.PI,Color.MAGENTA);
//Camera c1=new Camera(100, 50, (Math.PI)*2, 0, 150,200,0,Color.black);
public static void main(String[] a) {
JFrame f = new JFrame();
f.setSize(400, 400);
f.add(new Main());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
public void paint(Graphics g) {
//c1.paintComponent(g);
c.paintComponent(g);
}
}