/** Creates a particles at random locations. */ public void calculate() { frame.clearDrawables(); // remove old cirlces int n = control.getInt("number of particles"); double r = control.getDouble("radius"); for (int i = 0; i < n; i++) { double x = -10 + 20 * Math.random(); double y = -10 + 20 * Math.random(); frame.addDrawable(InteractiveShape.createCircle(x, y, r)); } }