public synchronized void addActionListener(ActionListener actionListener){
  if (actionListeners == null)   actionListeners=new ArrayList<ActionListener>();
  actionListeners.add(actionListener);
  if (fired) {
    actionListener.actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,""));
  }
}

public synchronized void addActionListener ( ActionListener actionListener ) { if ( actionListeners == null ) actionListeners = new ArrayList < ActionListener > ( ) ; actionListeners . add ( actionListener ) ; if ( fired ) { actionListener . actionPerformed ( new ActionEvent ( this , ActionEvent . ACTION_PERFORMED , "" ) ) ; } }
adds a listener that will be notified upon completion of all of the running threads . its actionperformed method will be called immediately if the threads already finished .
