package jp.sourceforge.acerola3d.a3applet;

import java.net.URL;
import javax.swing.*;

public class A3Applet extends JApplet {
    private static final long serialVersionUID = 1L;
    public void init() {
        String urlStr = getParameter("a3url");
        URL url = null;
        try {
            if (urlStr.startsWith("http://")||
                urlStr.startsWith("https://")||
                urlStr.startsWith("ftp://")||
                urlStr.startsWith("file://")) {
                url = new URL(urlStr);
            } else {
                URL base = this.getDocumentBase();
                url = new URL(base,urlStr);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        A3Panel a3panel = new A3Panel(url);
        getContentPane().add(a3panel);
        this.setTransferHandler(new A3TransferHandler(a3panel));
    }
    public void destroy() {
        jp.sourceforge.acerola3d.A23.cleanUp();
    }
}
