package applets;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */


public class JApplet
    extends Applet {
  boolean isStandalone = false;
  BorderLayout borderLayout1 = new BorderLayout();

  //Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
        (getParameter(key) != null ? getParameter(key) : def);
  }

  //Construct the applet
  public JApplet() {
  }

  //Initialize the applet
  public void init() {
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  //Component initialization
  private void jbInit() throws Exception {
  }

  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }

  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }

  // paint method from lecture notes
  public void paint(Graphics g) {
    g.setColor(Color.red);
    g.drawRect(5, 20, 100, 100);
    drawX(g,10,10,100,80,10);
  }

  public void drawX(Graphics g, int x, int y,
               int width, int height,
               int inset) {
    g.drawRect(x,y,width,height);
    g.drawLine(x + inset, y + inset,
               x + width - inset,
               y + height - inset);
    g.drawLine(x + width - inset, y + inset,
           x + inset, y + height - inset);

  }

}










