From 5e3b30218383ee6da117dbebf824e56c7c67943f Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 25 Jan 2005 17:05:33 +0000 Subject: [PATCH] extends Applet --- src/jalview/bin/Jalview.java | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index be0440a..69fd7b0 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -11,9 +11,53 @@ package jalview.bin; import jalview.gui.*; import javax.swing.*; +import java.awt.event.*; +import java.applet.Applet; -public class Jalview +public class Jalview extends JApplet { + public static JApplet applet; + Desktop frame; + public void init() + { + applet = this; + + frame = new Desktop(); + frame.setResizable(true); + frame.setVisible(true); + frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + frame.addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + applet.stop(); + applet.destroy(); + } + }); + + String file = getParameter("alignment"); + + if(file!=null) + { + jalview.bin.Cache.LAST_DIRECTORY = file; + String protocol = "File"; + if (file.indexOf("http:") > -1) + protocol = "URL"; + + String format = jalview.io.IdentifyFile.Identify(file, protocol); + + frame.LoadFile(file, protocol, format); + } + } + + public void destroy() + { + System.out.println("Goodbyeee"); + + applet.stop(); + frame.setVisible(false); + + } public static void main(String[] args) { try{ -- 1.7.10.2