package npw; import painter.SPainter; import shapes.SCircle; import shapes.SSquare; import javax.swing.*; import java.awt.*; public class Invention1 { public static void main(String[] args) { // CREATE OBJECTS TO THINK WITH SPainter miro = new SPainter("Invention 1", 600, 600); SSquare square = new SSquare(50); SCircle circle = new SCircle(30); miro.setColor(Color.ORANGE); square.expand(50); miro.paint(square); square.shrink(50); miro.mrt(square.side()); miro.setColor(Color.GREEN); miro.paint(circle); miro.mlt(square.side()); //GRAB THE INPUT INFORMATION while (true) { square.expand(50); Color colorOfSquare = changeColor(); miro.setColor(colorOfSquare); miro.paint(square); square.shrink(50); miro.mrt(2*square.side()); miro.setColor(Color.GREEN); miro.paint(circle); miro.mlt(2*square.side()); miro.mlt(2*square.side()); miro.setColor(Color.BLUE); miro.paint(circle); miro.mrt(2*square.side()); } } private static Color changeColor() { String color = JOptionPane.showInputDialog(null, "Change the color of the box?"); if (color.equalsIgnoreCase("orange")) { return Color.ORANGE; } else if (color.equalsIgnoreCase("green")) { return Color.GREEN; } else if (color.equalsIgnoreCase("blue")) { return Color.BLUE; } else { return Color.BLACK; } } }