public void startAnimation() { class AnimationThread extends Thread { public void run() { try { sorter.sort(); } catch (InterruptedException exception) { } } } int[] values = ArrayUtil.randomIntArray(30, 300); sorter = new SelectionSorter(values, this); animation = new AnimationThread();< animation.start(); }