// A class for loading pages into the WWW browser.
// Barry Cornelius, 30th January 2000
import java.io.     IOException;
import javax.swing. JEditorPane;
import javax.swing. JTextField;
public class PagesHandler
{
   private JEditorPane iJEditorPane;
   private JTextField iURLJTextField;
   public PagesHandler(final JEditorPane pJEditorPane,
                       final JTextField pURLJTextField)
   {
      iJEditorPane = pJEditorPane;
      iURLJTextField = pURLJTextField;
   }
   public void setPage(final String pURLString)   
   {
      try
      {
         iURLJTextField.setText(pURLString);
         iJEditorPane.setPage(pURLString);
      }
      catch(IOException pIOException)
      {
         iJEditorPane.setContentType("text/html");
         iJEditorPane.setText("<html>" +
                              "<body>" +
                              "<p>error in URL</p>" +
                              "</body>" +
                              "</html>\n");
      }
   }
}
