Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gpdraw.*;
- public class ParallelLinesRChangPeriod4 {
- private DrawingTool pen;
- private SketchPad pad;
- public ParallelLinesRChangPeriod4() {
- pad = new SketchPad(500, 500);
- pen = new DrawingTool(pad);
- }
- public void draw(int a) {
- for (int row = 0; row < 8; row++){
- //moves to the other square
- pen.up();
- pen.move(-400 + a/2,400 - a/2);
- pen.down();
- //changes a so that it wont be in the same spot all the time
- a /=3;
- // calculate the start of the row of squares
- // calculate and add a horizontal offset
- for (int col = 0; col < 7; col++){
- pen.fillRect(a,a);
- // draw the square
- // calculate and position for the next square
- }
- pen.up();
- pen.move(-400- a/2,400 - a/2);
- pen.down();
- pen.setDirection(0);
- pen.forward(500);
- // calculate the location and draw the line
- }
- }
- public static void main(String[] args) {
- ParallelLinesRChangPeriod4 bob = new ParallelLinesRChangPeriod4();
- bob.draw(40);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement