extends Applet
authoramwaterhouse <Andrew Waterhouse>
Tue, 25 Jan 2005 17:05:33 +0000 (17:05 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 25 Jan 2005 17:05:33 +0000 (17:05 +0000)
src/jalview/bin/Jalview.java

index be0440a..69fd7b0 100755 (executable)
@@ -11,9 +11,53 @@ package jalview.bin;
 \r
 import jalview.gui.*;\r
 import javax.swing.*;\r
+import java.awt.event.*;\r
+import java.applet.Applet;\r
 \r
-public class Jalview\r
+public class Jalview extends JApplet\r
 {\r
+  public static JApplet applet;\r
+  Desktop frame;\r
+  public void init()\r
+  {\r
+    applet = this;\r
+\r
+    frame = new Desktop();\r
+    frame.setResizable(true);\r
+    frame.setVisible(true);\r
+    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
+    frame.addWindowListener(new WindowAdapter()\r
+    {\r
+      public void windowClosing(WindowEvent e)\r
+      {\r
+          applet.stop();\r
+          applet.destroy();\r
+      }\r
+    });\r
+\r
+    String file = getParameter("alignment");\r
+\r
+    if(file!=null)\r
+    {\r
+      jalview.bin.Cache.LAST_DIRECTORY = file;\r
+      String protocol = "File";\r
+      if (file.indexOf("http:") > -1)\r
+        protocol = "URL";\r
+\r
+      String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+\r
+      frame.LoadFile(file, protocol, format);\r
+    }\r
+  }\r
+\r
+  public void destroy()\r
+  {\r
+    System.out.println("Goodbyeee");\r
+\r
+    applet.stop();\r
+    frame.setVisible(false);\r
+\r
+  }\r
 \r
    public static void main(String[] args) {\r
      try{\r