import java.awt.*;
import java.applet.*;
import java.net.*;

public class RButton3 extends Applet
{
 String text, fontname, html;
 int fontstyle, fontsize;
 int textcolor, textcolor2;
 int bgcolor, bgcolor2, bgc;
 int ovalcolor;
 Graphics g;

 public void init()
 {
  html = getParameter("html");
  text = getParameter("text");
  fontsize = Integer.valueOf(getParameter("size")).intValue();
  fontstyle = Integer.valueOf(getParameter("style")).intValue();
  fontname = getParameter("fontname");
  textcolor = Integer.valueOf(getParameter("textcolor")).intValue();
  textcolor2 = Integer.valueOf(getParameter("textcolor2")).intValue();
  bgc = Integer.valueOf(getParameter("bgc")).intValue();
  bgcolor = Integer.valueOf(getParameter("bgcolor")).intValue();
  bgcolor2 = Integer.valueOf(getParameter("bgcolor2")).intValue();
  ovalcolor = Integer.valueOf(getParameter("ovalcolor")).intValue();
  g = getGraphics();
  setBackground(new Color(bgc));
  }
public void paint (Graphics g)
{ 
  g.setColor(new Color(ovalcolor));
  g.drawRoundRect(0, 0, 56, 24, 18, 18);
  g.drawRoundRect(1, 1, 57, 25, 18, 18);
  g.drawRoundRect(2, 2, 58, 26, 18, 18);
  g.setColor(new Color(bgcolor));
  g.fillRoundRect(0, 0, 56, 24, 18, 18);
  g.setFont(new Font(fontname, fontstyle, fontsize));
  g.setColor(new Color(textcolor));
  g.drawString(text, 12, 17);
}

public boolean mouseDown (Event evt, int x, int y)
   {
     g.setColor(getBackground());   	 		//tyhjä kuva
     g.fillRect(0, 0, 64, 34);
     g.setColor(new Color(bgcolor2));
     g.fillRoundRect(3, 3, 59, 27, 18, 18);
     g.setFont(new Font(fontname, fontstyle, fontsize));
     g.setColor(new Color(textcolor2));
     g.drawString(text, 15, 20); 
     
     return true;
}

public boolean mouseUp (Event evt, int x, int y)
   {
       g.setColor(getBackground());			//tyhjä kuva 
       g.fillRect(0, 0, 64, 34);

      g.setColor(new Color(ovalcolor));
        g.drawRoundRect(0, 0, 56, 24, 18, 18);
        g.drawRoundRect(1, 1, 57, 25, 18, 18);
        g.drawRoundRect(2, 2, 58, 26, 18, 18);
      g.setColor(new Color(bgcolor));
        g.fillRoundRect(0, 0, 56, 24, 18, 18);
        g.setFont(new Font(fontname, fontstyle, fontsize));
        g.setColor(new Color(textcolor));
        g.drawString(text, 12, 17);
   
      try {	
	URL url = new URL(getDocumentBase(), html);
	getAppletContext().showDocument(url);
	  }
	catch (MalformedURLException e) {}

        return true;
   }
}
