\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