Active Visual Scaffolding by Charles Kelemen and Eugene Turk

More of the infrastructure code follows:

public void setArraySize(int size) { arraySize = size; displayedArray = new JButton[arraySize]; } public void setArray(int[] dataArray) { studentArray = dataArray; } public void initArray() { arrayPanel.add(Box.createRigidArea(new Dimension(5, 0))); if (arraySize > 0) for (int i = 0; i < arraySize; i++) { displayedArray[i] = new JButton("" + studentArray[i]); arrayPanel.add(displayedArray[i]); } } public void redraw() { for (int i = 0; i < arraySize; i++) { displayedArray[i].setText("" + studentArray[i]); } pause(); } .... public void highlight(int index, Color col, int delay) { displayedArray[index].setBackground(col); try { Thread.sleep (delay); } catch (InterruptedException e) { System.out.println("Error: sleep in highlight interrupted.\n"); } } public void unhighlight(int unhighlightElement) { pause(); displayedArray[unhighlightElement].setBackground(Color.lightGray); }

To pvwtalk15