public synchronized void write(String logData){
  if (logEnabled) {
    histData.append(logData);
    histData.revalidate();
synchronized (histData) {
      histData.notify();
    }
  }
}

public synchronized void write ( String logData ) { if ( logEnabled ) { histData . append ( logData ) ; histData . revalidate ( ) ; synchronized ( histData ) { histData . notify ( ) ; } } }
append text to the log , repaint the window and notify the autoscroll thread to scroll to the end of the text area .
