import java.awt.*; import java.applet.*; public class Insertion extends Applet implements Runnable { int stuff[] = new int[1000]; int a,b,c,d; int checked=0; int checking; boolean done=false; boolean start=true; public boolean mouseDown (Event e, int x, int y) { if(!start) start=true; return true; } public void init(){ setBackground(Color.white); } public void start(){ Thread t = new Thread(this); t.start(); } public void paint(Graphics g){ for(a=0;a<100;a++){ g.setColor(Color.green); if(a0;c--){ stuff[c]=stuff[c-1]; if(checking>=stuff[c-1]){ stuff[c]=checking; break done; } if(c==1) stuff[0]=checking; repaint(); try{Thread.sleep(10);} catch(InterruptedException e){} } } start=false; repaint(); try{Thread.sleep(1);} catch(InterruptedException e){} } } } }