<pre>
import java.awt.*;

abstract class BlankRemovePanel extends Panel {

   private boolean ok;
   private String title;
   protected String s;
   private int blankCount;
   private int size;
   private long calcTime;
   private Label titleLabel;
   private Label blankCountLabel;
   private Label sizeLabel;
   private Label timeLabel;
   private Label contentsLabel;
   private final int FILE_DISPLAY_SIZE = 20;


   public BlankRemovePanel (String title) {
      super();
      ok = false;
      this.title = title;
      setLayout(new GridLayout(5,1));
      titleLabel = new Label(title);
      blankCountLabel = new Label();
      sizeLabel = new Label();
      timeLabel = new Label();
      contentsLabel = new Label();
      add(titleLabel);
      add(contentsLabel);
      add(sizeLabel);
      add(blankCountLabel);
      add(timeLabel);
      refresh();
   }

   public void Clear() {
      ok = false;
      refresh();
   }

   public void refresh(boolean ok) {
      this.ok = ok;
      refresh();
   }

   public void refresh() {
      if (ok) {
         blankCountLabel.setText("Blanks: "+blankCount);
         sizeLabel.setText("Size: "+size);
         timeLabel.setText("Processing time: "+calcTime+" ms.");
          if (s.length() > FILE_DISPLAY_SIZE)
             contentsLabel.setText("Contents: "+
                  s.substring(0,FILE_DISPLAY_SIZE));
          else
             contentsLabel.setText("Contents: "+s);
      }  
      else {
         blankCountLabel.setText("");
         sizeLabel.setText("");
         timeLabel.setText("");
         contentsLabel.setText("");
      }  
   }

   public void calculate(String str) {
      long timeStart;
      long timeEnd;
      timeStart = System.currentTimeMillis();
      removeBlanks(str);
      timeEnd = System.currentTimeMillis();
      calcTime = timeEnd - timeStart;
      if (s != null) {
         blankCount =  BlankRemovers.blankCounter(s);
         size =  s.length();
         ok = true;
         refresh();
      }
   }

   abstract public void removeBlanks(String str);
 
}
 
</pre>
