1 package npw; 2 3 import painter.SPainter; 4 import shapes.SCircle; 5 import shapes.SSquare; 6 import java.awt.Color; 7 import javax.swing.SwingUtilities; 8 9 public class Invention1 { 10 11 private void paintTheImage() { 12 SPainter Dylan = new SPainter("Invention1", 1000, 1000); 13 SSquare square = new SSquare(300); 14 SCircle circle = new SCircle(150); 15 Dylan.setColor(Color.LIGHT_GRAY); 16 Dylan.tr(45); 17 Dylan.paint(square); 18 Dylan.tr(45); 19 Dylan.mfd(300); 20 Dylan.paint(circle); 21 Dylan.moveToCenter(); 22 Dylan.mbk(300); 23 Dylan.paint(circle); 24 Dylan.moveToCenter(); 25 Dylan.mlt(300); 26 Dylan.paint(circle); 27 Dylan.moveToCenter(); 28 Dylan.ta(); 29 Dylan.mlt(300); 30 Dylan.paint(circle); 31 Dylan.ta(); 32 Dylan.moveToCenter(); 33 Dylan.tr(45); 34 Dylan.mlt(300); 35 circle.setRadius(25); 36 int i = 1; 37 while (i < 14) { 38 if (i == 1) { 39 Dylan.setColor(Color.GREEN); 40 } else if (i==2) { 41 Dylan.setColor(Color.BLACK); 42 } else if (i==3) { 43 Dylan.setColor(Color.GREEN); 44 } else if (i==4) { 45 Dylan.setColor(Color.BLACK); 46 } else if (i==5) { 47 Dylan.setColor(Color.GREEN); 48 } else if (i==6) { 49 Dylan.setColor(Color.BLACK); 50 } else if (i==7) { 51 Dylan.setColor(Color.GREEN); 52 } else if (i==8) { 53 Dylan.setColor(Color.BLACK); 54 } else if (i==9) { 55 Dylan.setColor(Color.GREEN); 56 } else if (i==10) { 57 Dylan.setColor(Color.BLACK); 58 } else if (i==11) { 59 Dylan.setColor(Color.GREEN); 60 } else if (i==12) { 61 Dylan.setColor(Color.BLACK); 62 } else if (i==13) { 63 Dylan.setColor(Color.GREEN); 64 } 65 66 Dylan.paint(circle); 67 Dylan.mrt(circle.diameter()); 68 i = i + 1; 69 70 } 71 72 Dylan.moveToCenter(); 73 Dylan.mfd(300); 74 circle.setRadius(25); 75 int k = 1; 76 while (k < 14) { 77 if (k == 1) { 78 Dylan.setColor(Color.GREEN); 79 } else if (k==2) { 80 Dylan.setColor(Color.BLACK); 81 } else if (k==3) { 82 Dylan.setColor(Color.GREEN); 83 } else if (k==4) { 84 Dylan.setColor(Color.BLACK); 85 } else if (k==5) { 86 Dylan.setColor(Color.GREEN); 87 } else if (k==6) { 88 Dylan.setColor(Color.BLACK); 89 } else if (k==7) { 90 Dylan.setColor(Color.GREEN); 91 } else if (k==8) { 92 Dylan.setColor(Color.BLACK); 93 } else if (k==9) { 94 Dylan.setColor(Color.GREEN); 95 } else if (k==10) { 96 Dylan.setColor(Color.BLACK); 97 } else if (k==11) { 98 Dylan.setColor(Color.GREEN); 99 } else if (k==12) { 100 Dylan.setColor(Color.BLACK); 101 } else if (k==13) { 102 Dylan.setColor(Color.GREEN); 103 } 104 105 Dylan.paint(circle); 106 Dylan.mbk(circle.diameter()); 107 k = k + 1; 108 109 } 110 } 111 public Invention1() { 112 paintTheImage(); 113 114 } 115 116 public static void main(String[] args) { 117 SwingUtilities.invokeLater(new Runnable() { 118 public void run() { 119 new Invention1(); 120 } 121 }); 122 } 123 }