package assignment4; import painter.SPainter; import shapes.SSquare; import javax.swing.*; import java.awt.*; import java.util.Scanner; public class Stella { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Stella(); } }); } public Stella() { paintimage(); } private static Color randomColor(){ int rv = (int) (Math.random() * 256); int gv = (int) (Math.random() * 256); int bv = (int) (Math.random() * 256); return new Color(rv, gv, bv); } private void paintimage() { Color one = randomColor(); Color two = randomColor(); int squarecount = numberpls("How many concentric squares"); int l = 700/squarecount; int y = 0; SPainter S = new SPainter("Stella", 800, 800); SSquare tella = new SSquare(700); while(y < squarecount){ if(y % 2 == 0){ S.setColor(one); } else{ S.setColor(two); } S.paint(tella); tella.resetSide((int) (tella.side()-l)); y=y+1; } } private static int numberpls(String prompt) { String n = JOptionPane.showInputDialog(null,prompt+"?"); Scanner scan = new Scanner(n); return scan.nextInt(); } }