import java.awt.*;
import java.applet.*;
import java.net.*;

public class RButton1 extends Applet
{
  String kohde, fontname, buttonname, html;
  int fontstyle, fontsize;

   public void init()
 {
  kohde = getParameter("kohde");
  fontsize = Integer.valueOf(getParameter("size")).intValue();
  fontstyle = Integer.valueOf(getParameter("style")).intValue();
  fontname = getParameter("fontname");
  buttonname = getParameter("buttonname");
  html = getParameter("html");
  setFont(new Font(fontname, fontstyle, fontsize));

  setLayout(new GridLayout(1,0,0,0));
  Button b = new Button(buttonname); 
  b.setBackground(Color.orange);
  b.setForeground(Color.white);
  add (b);
  
 }
public boolean action(Event evt, Object arg)
 {
  if (buttonname.equals(arg))
     {
      try {
	
	URL url = new URL(getDocumentBase(), html);
	getAppletContext().showDocument(url, kohde);
        // kohde - jos, käytät frameita
        // <FRAME SRC="Rainex.html" NAME="kohde">
	  }
	catch (MalformedURLException e) {}		
     }
   
   return true; 
  }
}
