1 package npw; 2 3 import painter.SPainter; 4 import shapes.SCircle; 5 import shapes.SSquare; 6 7 import javax.swing.*; 8 import java.awt.*; 9 10 public class Invention1 { 11 12 13 14 15 //Solution to the TARGET Problem 16 private void paintIt() { 17 SPainter gogh = new SPainter("invention1", 600,600); 18 SCircle dot = new SCircle(25); 19 SSquare square = new SSquare(400); 20 if (2>1){ 21 gogh.setColor(Color.black); 22 gogh.draw(square); 23 24 } else{gogh.setColor(Color.green); 25 gogh.paint(square);} 26 gogh.mfd(150); 27 gogh.mlt(150); 28 gogh.paint(dot); 29 30 int x = 0; 31 while(x<4) { 32 gogh.mbk(75); 33 gogh.mrt(75); 34 gogh.paint(dot); 35 x = x + 1; 36 } 37 38 39 40 41 } 42 43 44 45 46 //REQUIRED INFRASTRUCTURE 47 48 49 public Invention1() { 50 paintIt(); 51 } 52 53 public static void main(String[] args){ 54 SwingUtilities.invokeLater(new Runnable() { 55 public void run() { 56 new Invention1(); 57 } 58 }); 59 } 60 }