import java.awt.*; class InsertionCanvas extends Canvas { public String[] codearray; int j, width, height; InsertionCanvas() { codearray = new String[20]; codearray[0]=new String("for(counter = 1; counter0) && (numarray[counter2-1] > current)) {"); codearray[4]=new String(" numarray[counter2] = numarray[counter2-1];"); codearray[5]=new String(" counter2--;"); codearray[6]=new String(" }"); codearray[7]=new String(" numarray[counter2] = current;"); codearray[8]=new String("}"); } public void paint(Graphics g) { width = size().width; height = size().height; g.setColor(Color.black); for(j=0;j<9;j++) { g.drawString(codearray[j],15,15*(j+1)); } g.drawRect(1,1,width-2,height-2); } //If we don't specify this, the canvas might not show up at all //(depending on the layout manager). public Dimension minimumSize() { return new Dimension(600,400); } //If we don't specify this, the canvas might not show up at all //(depending on the layout manager). public Dimension preferredSize() { return minimumSize(); } }