<pre>

import java.awt.*;
import java.awt.event.*;
import java.applet.*;

public class BlankTestApplet extends Applet implements ActionListener {

   private final int FILE_DISPLAY_SIZE = 40;
   private final int NUM_ALGORITHMS = 3;


   Button readShortButton;
   Button readMediumButton;
   Button readLongButton;
   Button[] applyButtons;
   Button remoteLocalButton;
   String file = null;
   boolean localFlag = true;
   String filename = "";
   String filenameAppend = "";
   String remoteURL = 
  "http://ringer.cs.utsa.edu/~srobbins/classes/cs4773s2000/assign/assign1test/";
   int numBlanks;
   Label localRemoteLabel;
   Label filenameLabel;
   Label filestartLabel;
   Label filesizeLabel;
   Label fileblanksLabel;
   BlankRemovePanel[] panels;
   String[] algorithmNames = {"String","Buffer","Tokenizer"};

   public void init() {
      panels = new BlankRemovePanel[NUM_ALGORITHMS];
      panels[0] = new BlankRemovePanelString(algorithmNames[0]);
      panels[1] = new BlankRemovePanelBuffer(algorithmNames[1]);
      panels[2] = new BlankRemovePanelTokenizer(algorithmNames[2]);
     
      panels[0].setBackground(Color.cyan);
      panels[1].setBackground(Color.yellow);
      panels[2].setBackground(Color.cyan);

      setupLayout();
   }

   private void setupLayout() {
      setBackground(Color.lightGray);
      setForeground(Color.black);
      setLayout(new BorderLayout());
      Panel mainLabels = new Panel();
      mainLabels.setLayout(new GridLayout(6,1));
      mainLabels.setBackground(Color.pink);
      Panel infoPanel = new Panel();
      infoPanel.setLayout(new GridLayout(1,3));
      Panel lowerButtons = new Panel();
      lowerButtons.setLayout(new BorderLayout());
      Panel upperButtons = new Panel();
      upperButtons.setLayout(new GridLayout(1,1));
      Panel readApplyButtons = new Panel();
      readApplyButtons.setLayout(new GridLayout(2,3));
      add(BorderLayout.NORTH,mainLabels);
      add(BorderLayout.CENTER,infoPanel);
      add(BorderLayout.SOUTH,lowerButtons);
      lowerButtons.add(BorderLayout.NORTH,upperButtons);
      upperButtons.add(remoteLocalButton = new Button("Remote/Local"));
      lowerButtons.add(BorderLayout.CENTER,readApplyButtons);
      Label programmerLabel = 
         new Label("This applet was written by S. Robbins");
      localRemoteLabel = new Label("");
      filenameLabel = new Label();
      filestartLabel = new Label();
      filesizeLabel = new Label();
      fileblanksLabel = new Label();
      mainLabels.add(programmerLabel);
      mainLabels.add(localRemoteLabel);
      mainLabels.add(filenameLabel);
      mainLabels.add(filestartLabel);
      mainLabels.add(filesizeLabel);
      mainLabels.add(fileblanksLabel);
      readShortButton = new Button("Read Short");
      readMediumButton = new Button("Read Medium");
      readLongButton = new Button("Read Long");
      applyButtons = new Button[NUM_ALGORITHMS];
      readApplyButtons.add(readShortButton);
      readApplyButtons.add(readMediumButton);
      readApplyButtons.add(readLongButton);
      for (int i=0;i &lt NUM_ALGORITHMS;i++) {
         applyButtons[i] = new Button("Apply "+algorithmNames[i]);
         readApplyButtons.add(applyButtons[i]);
         applyButtons[i].addActionListener(this);
      }
      readShortButton.addActionListener(this);
      readMediumButton.addActionListener(this);
      readLongButton.addActionListener(this);
      remoteLocalButton.addActionListener(this);
      setLocalRemoteLabel();
      for (int i=0;i &lt NUM_ALGORITHMS;i++)
         infoPanel.add(panels[i]);
   }

   private void setLocalRemoteLabel() {
        if (localFlag)
           localRemoteLabel.setText("File source: Local");
        else
           localRemoteLabel.setText("File source: Remote");
   }

   private void setFileInfo() {
      filenameLabel.setText("File: "+filenameAppend + filename);
      if (file != null) {
          if (file.length() > FILE_DISPLAY_SIZE)
             filestartLabel.setText("Contents: "+
                  file.substring(0,FILE_DISPLAY_SIZE));
          else
             filestartLabel.setText("Contents: "+file);
          filesizeLabel.setText("File Size: "+file.length());
          fileblanksLabel.setText("File Blanks: "+numBlanks);
      }
      else {
          filesizeLabel.setText("");
          fileblanksLabel.setText("");
          filestartLabel.setText("");
      }
   }

   private void readFile(String fn) {
      String fname;
      filename = fn;
      fname = filenameAppend + fn;
      file = FileIO.ReadEntireFile(fname,this);
      if (file != null)
         numBlanks = BlankRemovers.blankCounter(file);
      setFileInfo();
      for (int i=0;i &lt NUM_ALGORITHMS;i++) {
         panels[i].refresh(false);
      }
   }


   public void actionPerformed (ActionEvent e) {
     if (e.getSource() == remoteLocalButton) {
        if (localFlag) {
           localFlag = false;
           filenameAppend = remoteURL;
           setLocalRemoteLabel();
        }
        else {
           localFlag = true;
           filenameAppend = "";
           setLocalRemoteLabel();
        }
     }
     if (e.getSource() == readShortButton) 
        readFile("input.short");
     if (e.getSource() == readMediumButton) 
        readFile("input.medium");
     if (e.getSource() == readLongButton)
        readFile("input.long");
     for (int i=0;i &lt NUM_ALGORITHMS;i++)
        if (e.getSource() == applyButtons[i]) 
          panels[i].calculate(file);
   }

}
</pre>
