i've been struggling with the delay timer. how can i make the swapping visible to observer? and by putting color on selected bar while the swapping is processing? This is a selection sort by the way.
selectionSort2.java
 /**
 *
 * @author Yuvinng
 */
 import java.awt.*; 
 import javax.swing.*;
import java.util.Random;
import javax.swing.Timer;
import java.awt.event.*;
 public class SelectionSortPanel2  extends JPanel{
protected JButton selection;
private final int width=400,height=400;
private static Random generator;
private int[] list=new int[100];
private Timer timer;
public void selectionSort(int[] list)
{
int min;
int temp;
for(int index=0; index<list.length-1;index++)
{
min=index;
for(int scan=index+1;scan<list.length;scan++)
 if(list[scan]<(list[min]))
     min=scan;
temp=list[min];
list[min]=list[index];
 list[index]=temp;
repaint();
}    
}
private class swapper implements ActionListener 
   {
      public void actionPerformed(ActionEvent event)
      {   
         selectionSort(list);
      }
   }
 }