1 /* 2 * Invention that makes the same picture no matter the user input. 3 */ 4 5 package npw; 6 7 import java.awt.Color; 8 import javax.swing.SwingUtilities; 9 import painter.SPainter; 10 import shapes.SCircle; 11 import shapes.SSquare; 12 13 public class Invention1 { 14 private void paintTheImage() { 15 int number = 4; 16 SPainter painter = new SPainter("Image", 800, 800); 17 SCircle circle = new SCircle(300); 18 SSquare square = new SSquare(200); 19 while (number < 10) { 20 if (number % 4 == 0) { 21 painter.setColor(Color.BLUE); 22 painter.draw(circle); 23 } else { 24 painter.setColor(Color.GREEN); 25 painter.draw(square); 26 } 27 circle.shrink(20); 28 square.shrink(20); 29 number = number + 1; 30 } 31 } 32 33 34 public Invention1(){ 35 paintTheImage(); 36 } 37 38 public static void main(String[] args){ 39 SwingUtilities.invokeLater(new Runnable() { 40 @Override 41 public void run() { 42 new Invention1(); 43 } 44 }); 45 } 46 } 47 48 49 50 51 52