public void stopTimer(){
  if (timer != null) {
    timer.cancel();
    timer.purge();
    timer=null;
  }
  if (timerButton != null) {
    timerButton.setSelected(false);
  }
}

public void stopTimer ( ) { if ( timer != null ) { timer . cancel ( ) ; timer . purge ( ) ; timer = null ; } if ( timerButton != null ) { timerButton . setSelected ( false ) ; } }
called when the timer should be stopped .
