001package edu.pdx.cs410J.family;
002
003import java.net.MalformedURLException;
004import java.net.URL;
005
006import javax.swing.JApplet;
007
008/**
009 * This class is an applet that displays an immutable family tree.  
010 */
011@SuppressWarnings("serial")
012public class FamilyTreeApplet extends JApplet {
013
014  /**
015   * Creates a <code>FamilyTreePanel</code> to view a family tree.
016   */
017  public void init() {
018    FamilyTreePanel viewer = new FamilyTreePanel();
019    viewer.addComponents();
020    this.getContentPane().add(viewer);
021
022    String xmlFile = this.getParameter("xmlFile");
023    if (xmlFile != null) {
024      URL url = null;
025      try {
026//         URL base = this.getDocumentBase();
027//         url = new URL(base, xmlFile);
028        url = new URL(xmlFile);
029        viewer.setURLSource(url);
030
031      } catch (MalformedURLException ex) {
032        viewer.setSourceText(ex.toString());
033      }
034    }
035  }
036}