Invention2.java
1    package npw;
2    
3    import painter.SPainter;
4    import shapes.SRectangle;
5    import java.awt.*;
6    import java.util.Random;
7    
8    
9    public class Invention2 {
10       public static void main(String[] args) {
11           SRectangle keys = new SRectangle(100, 10);
12           SPainter art = new SPainter("Invention2", 600, 600);
13   
14           int x = 1;
15           while (x <= 50) {
16               art.paint(keys);
17               art.move();
18               art.setColor(Color.PINK);
19               art.paint(keys);
20               x = x + 1;
21           }
22   
23           int abc = 1;
24   
25           while (abc < 20) {
26               if (abc == 1) {
27                   art.setColor(Color.CYAN);
28               } else if (abc == 2) {
29   
30               } else if (abc == 3) {
31                   art.setColor(Color.YELLOW);
32               } else if (abc == 4) {
33   
34               } else if (abc == 5) {
35                   art.setColor(Color.BLUE);
36               } else {
37                   art.setColor(Color.RED);
38               }
39               art.move();
40               art.paint(keys);
41               abc = abc + 1;
42           }
43   
44           art.setColor(Color.BLACK);
45           art.moveToCenter();
46           art.draw(keys);
47   
48   
49       }
50   }
51