stick with cross platform look and feel!!!
[jalview.git] / src / jalview / bin / Jalview.java
1 /********************\r
2  * 2004 Jalview Reengineered\r
3  * Barton Group\r
4  * Dundee University\r
5  *\r
6  * AM Waterhouse\r
7  *******************/\r
8 \r
9 \r
10 package jalview.bin;\r
11 \r
12 import jalview.gui.*;\r
13 import javax.swing.*;\r
14 import java.awt.event.*;\r
15 import jalview.io.*;\r
16 \r
17 \r
18 public class Jalview extends JApplet\r
19 {\r
20   public static JApplet applet;\r
21   Desktop frame;\r
22   public void init()\r
23   {\r
24     applet = this;\r
25 \r
26     frame = new Desktop();\r
27     frame.setResizable(true);\r
28     frame.setVisible(true);\r
29     frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
30     frame.addWindowListener(new WindowAdapter()\r
31     {\r
32       public void windowClosing(WindowEvent e)\r
33       {\r
34           applet.stop();\r
35           applet.destroy();\r
36       }\r
37     });\r
38 \r
39     String file = getParameter("alignment");\r
40 \r
41     if(file!=null)\r
42     {\r
43       jalview.bin.Cache.setProperty("LAST_DIRECTORY", file);\r
44       String protocol = "File";\r
45       if (file.indexOf("http:") > -1)\r
46         protocol = "URL";\r
47 \r
48       String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
49 \r
50       frame.LoadFile(file, protocol, format);\r
51     }\r
52   }\r
53 \r
54   public void destroy()\r
55   {\r
56     if(applet!=null)\r
57       applet.stop();\r
58     else\r
59       System.exit(0);\r
60     frame.setVisible(false);\r
61   }\r
62 \r
63    public static void main(String[] args) {\r
64 \r
65     Cache.loadProperties();\r
66 \r
67     try{\r
68        UIManager.setLookAndFeel(\r
69    //   "javax.swing.plaf.metal.MetalLookAndFeel"\r
70     //  "javax.swing.plaf.multi.MultiLookAndFeel"\r
71      //    UIManager.getSystemLookAndFeelClassName()\r
72          UIManager.getCrossPlatformLookAndFeelClassName()\r
73        // "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"\r
74        //   "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"\r
75        //  "com.sun.java.swing.plaf.motif.MotifLookAndFeel"\r
76      );\r
77      }\r
78      catch (Exception ex)\r
79      {}\r
80 \r
81     // JFrame.setDefaultLookAndFeelDecorated(true);\r
82      Desktop frame = new Desktop();\r
83      frame.setResizable(true);\r
84      frame.setVisible(true);\r
85 \r
86 \r
87      if(args!=null && args.length>0)\r
88      {\r
89          String file = args[0];\r
90          String protocol = "File";\r
91          if(file.indexOf("http:")>-1)\r
92            protocol = "URL";\r
93 \r
94          String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
95 \r
96          frame.LoadFile(file, protocol, format);\r
97      }\r
98 \r
99    }\r
100 \r
101 }\r
102 \r