Is there any short way to draw the same size rectangles?
We started to learn about animation in my class....Yeahh...how exciting!.
Our homework is to draw something and make it move (animate). I'm basically done but my Applet codes are reallyyyyy long. I wonder if there's an easy way of coding this. Does every object needs to have different codes. Example below: I'm making a 'broken white lines' for the street. The rectangles are all the same size, the only different is the position of the 'x'. Is there any short way of doing it?
g.setColor(Color.white);
g.fillRect(0,520,25,5);
g.fillRect(50,520,25,5);
g.fillRect(100,520,25,5);
g.fillRect(150,520,25,5);
g.fillRect(200,520,25,5);
g.fillRect(250,520,25,5);
g.fillRect(300,520,25,5);
g.fillRect(350,520,25,5);
g.fillRect(400,520,25,5);
g.fillRect(450,520,25,5);
g.fillRect(500,520,25,5);
g.fillRect(550,520,25,5);

