/* *program to paint dots in the context of the non representational painting world, npw * */ package npw; import java.awt.Color; import java.awt.geom.Point2D; import javax.swing.SwingUtilities; import painter.SPainter; import shapes.SCircle; public class Dots { //solution to dots problem private void paintTheImage(){ SPainter painter = new SPainter("Dots" , 1000 , 1000); SCircle dot = new SCircle( 10); Point2D.Double coords = new Point2D.Double(); //I need 9 circles //only 1 can touch the y axis //cant touch each other // 4 different sizes, 4 different colors //symmetrical //set the first(odd) dot on top center to satisfy symmetry coords.setLocation(500,100); painter.moveTo(coords); painter.setColor(Color.BLUE); painter.paint(dot); //set of two dots to satisfy 1/4 color and size difference coords.setLocation(800, 200); dot.setRadius(10); painter.moveTo(coords); painter.setColor(Color.BLUE); painter.paint(dot); coords.setLocation(200, 200); painter.moveTo(coords); painter.paint(dot); //set of two dots 2/4 color size difference progress coords.setLocation(800, 300); dot.setRadius(30); painter.moveTo(coords); painter.setColor(Color.YELLOW); painter.paint(dot); coords.setLocation(200, 300); painter.moveTo(coords); painter.paint(dot); //set of dots for the 3/4 color size dif coords.setLocation(800, 400); dot.setRadius(60); painter.moveTo(coords); painter.setColor(Color.GREEN); painter.paint(dot); coords.setLocation(200, 400); painter.moveTo(coords); painter.paint(dot); // set of dots for the last 4/4 color size difference. we should have all 9 dots now coords.setLocation(800, 800); dot.setRadius(90); painter.moveTo(coords); painter.setColor(Color.PINK); painter.paint(dot); coords.setLocation(200, 800); painter.moveTo(coords); painter.paint(dot); } //required infrastructure public Dots(){ paintTheImage(); } public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Dots(); } }); } }