/home/akc/NetBeansProjects/CS1/src/npw/PumpItUp.java
 1 /*
 2  * Program to paint an image of the PumpIt Up dance floor in the context of the
 3  * Nonrepresentational Painting World, NPW.
 4  */
 5 
 6 package npw;
 7 
 8 import java.awt.Color;
 9 import javax.swing.SwingUtilities;
10 import painter.SPainter;
11 import shapes.SSquare;
12 
13 /**
14  *
15  * @author akc
16  */
17 public class PumpItUp {
18 
19     // THE SOLUTION TO THE PUMP IT UP PROBLEM
20     
21     private void paintTheImage() {
22         SPainter painter = new SPainter("Pump It Up",600,600);
23         SSquare square = new SSquare(150);
24         paintYellowSquare(painter,square);
25         paintRedSquares(painter,square);
26         paintBlueSquares(painter,square);
27         paintGraySquares(painter,square);
28     }
29     
30     // REQUIRED INFASTRUCTURE
31     
32     public PumpItUp() {
33         paintTheImage();
34     }
35     
36     public static void main(String[] args) {
37         SwingUtilities.invokeLater(new Runnable() {
38             public void run() {
39                 new PumpItUp();
40             }
41         });
42     }
43 
44     private void paintYellowSquare(SPainter painter, SSquare square) {
45         painter.setColor(Color.YELLOW);
46         painter.paint(square);
47     }
48 
49     private void paintRedSquares(SPainter painter, SSquare square) {
50         painter.setColor(Color.RED);
51         painter.mfd(150);
52         painter.mlt(150);
53         painter.paint(square);
54         painter.mrt(300);
55         painter.paint(square);
56         painter.moveToCenter();
57     }
58 
59     private void paintBlueSquares(SPainter painter, SSquare square) {
60         painter.setColor(Color.BLUE);
61         painter.mbk(150);
62         painter.mlt(150);
63         painter.paint(square);
64         painter.mrt(300);
65         painter.paint(square);
66         painter.moveToCenter();
67     }
68 
69     private void paintGraySquares(SPainter painter, SSquare square) {
70         painter.setColor(Color.GRAY);
71         painter.mbk(150);
72         painter.paint(square);
73         painter.mfd(300);
74         painter.paint(square);
75         painter.mbk(150);
76         painter.mlt(150);
77         painter.paint(square);
78         painter.mrt(300);
79         painter.paint(square);
80         painter.moveToCenter();
81     }
82     
83 }
84