
package edu.unl.consystlab.gui;

import java.applet.Applet;
import java.awt.Label;

public class Launcher extends Applet implements Runnable
{
   private String aName=null;
   private String aClass=null;
   private Thread thread;
   private   Label label;

   public void init ()
   {
      String p;
      aName=getParameter("name", "unset?");
      aClass=getParameter("class", "unset?");
      this.add(label = new Label("Launching "+aName+"..."));
      thread=new Thread(this);
      thread.start();
   }

   public void run()
   { 
      Object o=null;
      try { o = Class.forName(aClass).newInstance(); }
      catch(Exception e) { }
      if(o==null)
         label.setText("Error loading " + aName + "("+aClass+")");
      else
         label.setText("Just launched " + aName + ".");
      label.repaint();
   }

   public String getParameter(String param, String dflt)
   {
      try {
         return super.getParameter(param); 
      } catch(Exception e) { return dflt; }
   }

}

