日期:2014-05-20 浏览次数:20835 次
private class StartListener implements ActionListener{
public void actionPerformed(ActionEvent e){
int[] unsort=UnsortGenerator(); //函数返回给unsort一个数组
engine.setArray(unsort);
engine.setAlgorithm(getAlgorithm());
engine.setSleepTime(jslSpeed.getValue()*50);
engine.setHistogram(histogram); //Histogram是用来画柱状图的
engine.run();
}
}
private SelectionSort selectionSort=new SelectionSort();
...
if (thread != null && thread.getState() != Thread.State.TERMINATED)
return;
thread=new Thread(selectionSort);
selectionSort.setArray(unsort);
thread.start();
public class SelectionSort implements Runnable{
private int[] unsort;
private Histogram histogram;
private int sleepTime;
public void run(){
selectionSort();
}
public void setArray(int[] unsort){