// Customized highlight title applet -- Williams
// Original applet by Anibal Wainstein of Demicron software, Sweden 
import hilitetitle;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
// Customize the applet
public class custhilite extends hilitetitle 
{
  public void init()  // applet initialization
  {
    // let the real applet initialize
    super.init();
    // listen for mouse click
    addMouseListener(
       new MouseAdapter() 
         {
           public void mousePressed(MouseEvent e)
           { 
              // When mouse clicks, jump to URL, if available
              String url=getParameter("URL");
              try {
                 URL urlo= new URL(url);
                 getAppletContext().showDocument(urlo);
              } catch (MalformedURLException ignore) { };  // ignore
           }
         }
    );
  }
  // Paint the applet
  public void paint(Graphics g)
  {
    // call original paint
    super.paint(g);
    // see if border is requested
    String param=getParameter("Border");
    if (param==null) param="Y";  // default
    if (param.length()==0 ||
        param.equalsIgnoreCase("Y")||
        param.equals("1")||
        param.equalsIgnoreCase("yes"))
        {
          // draw our custom border
          Dimension d=getSize();  // JDK 1.1
          int clr;
          // Get color from parameter
          param=getParameter("BorderColor");
          if (param==null)
             clr=0xFF0000; // red default
          else
             clr=Integer.parseInt(param,16);
          Color c= new Color(clr);
          g.setColor(c);
          g.drawRect(0,0,d.width-1,d.height-1);
        }
  }
  // provide default parameter
  public String getParameter(String name)
  {
    if (name.equals("font"))  // could do others
    {
       String s=super.getParameter(name);
       if (s==null) return "Helvetica"; else return s;
    }
    return super.getParameter(name);
  }
}