Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. import gpdraw.*;
  2.  
  3. public class ParallelLinesRChangPeriod4 {
  4. private DrawingTool pen;
  5. private SketchPad pad;
  6.  
  7. public ParallelLinesRChangPeriod4() {
  8. pad = new SketchPad(500, 500);
  9. pen = new DrawingTool(pad);
  10. }
  11.  
  12. public void draw(int a) {
  13. for (int row = 0; row < 8; row++){
  14. //moves to the other square
  15. pen.up();
  16. pen.move(-400 + a/2,400 - a/2);
  17. pen.down();
  18. //changes a so that it wont be in the same spot all the time
  19. a /=3;
  20. // calculate the start of the row of squares
  21. // calculate and add a horizontal offset
  22.  
  23. for (int col = 0; col < 7; col++){
  24. pen.fillRect(a,a);
  25. // draw the square
  26. // calculate and position for the next square
  27. }
  28. pen.up();
  29. pen.move(-400- a/2,400 - a/2);
  30. pen.down();
  31. pen.setDirection(0);
  32. pen.forward(500);
  33. // calculate the location and draw the line
  34. }
  35. }
  36. public static void main(String[] args) {
  37. ParallelLinesRChangPeriod4 bob = new ParallelLinesRChangPeriod4();
  38. bob.draw(40);
  39. }
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement