KanizsaSquare.java
1    /* 
2     *Program to paint a Kanizsa Square in the context of the Nonrepresentational 
3     * 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.SCircle;
12   import shapes.SSquare;
13   
14   public class KanizsaSquare {
15       // THE SOLUTION TO THE BLUE DOT PROBLEM
16       private void paintTheImage () {
17           SPainter nono = new SPainter("Kanizsa Square", 400,400);
18   
19           SCircle Bleu = new SCircle (75);
20           nono.mlt(100);
21           nono.mfd(120);
22           nono.setColor(Color. BLUE);
23           nono.paint(Bleu);
24           nono.moveToCenter();
25   
26           SCircle Rouge = new SCircle (75);
27           nono.mrt(100);
28           nono.mbk(120);
29           nono.setColor(Color. RED);
30           nono.paint(Rouge);
31           nono.moveToCenter();
32   
33           SCircle Vert = new SCircle (75);
34           nono.mrt(100);
35           nono.mfd(120);
36           nono.setColor(Color. GREEN);
37           nono.paint(Vert);
38           nono.moveToCenter();
39   
40           SCircle Verte = new SCircle (75);
41           nono.mlt(100);
42           nono.mbk(120);
43           nono.setColor(Color. GREEN);
44           nono.paint(Verte);
45           nono.moveToCenter();
46           
47           SSquare square = new SSquare(200);
48           nono.setColor(Color.WHITE);
49           nono.paint(square);
50   
51       }
52   
53   
54   
55       public KanizsaSquare() {
56           paintTheImage();
57       }
58   
59       public static void main(String[] args) {
60           SwingUtilities.invokeLater(new Runnable() {
61               public void run() {
62                   new KanizsaSquare();
63               }
64           });
65       }
66   
67   }
68   
69