2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
20 package jalview.bin;
\r
22 import jalview.gui.*;
\r
23 import javax.swing.*;
\r
24 import java.awt.event.*;
\r
25 import jalview.io.*;
\r
27 import org.apache.log4j.*;
\r
29 public class Jalview extends JApplet
\r
31 public static JApplet applet;
\r
36 Cache.loadProperties();
\r
37 jalview.gui.Preferences.initPreferences();
\r
39 frame = new Desktop();
\r
40 frame.setResizable(true);
\r
41 frame.setVisible(true);
\r
42 frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
\r
43 frame.addWindowListener(new WindowAdapter()
\r
45 public void windowClosing(WindowEvent e)
\r
52 String file = getParameter("alignment");
\r
56 jalview.bin.Cache.setProperty("LAST_DIRECTORY", file);
\r
57 String protocol = "File";
\r
58 if (file.indexOf("http:") > -1)
\r
61 String format = jalview.io.IdentifyFile.Identify(file, protocol);
\r
63 frame.LoadFile(file, protocol, format);
\r
67 public void destroy()
\r
73 frame.setVisible(false);
\r
76 private static void initLogger() {
\r
77 Logger l = Logger.getLogger("org.apache.axis");
\r
78 if (Cache.getProperty("logs.Axis.Level")==null) {
\r
79 Cache.setProperty("logs.Axis.Level", Level.INFO.toString());
\r
82 l.setLevel(Level.toLevel(Cache.getProperty("logs.Axis.Level")));
\r
83 ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),"System.err");
\r
87 public static void main(String[] args) {
\r
89 Cache.loadProperties();
\r
90 jalview.gui.Preferences.initPreferences();
\r
93 } catch (Exception e) {
\r
94 System.err.println("Problems initializing the log4j system\n");
\r
95 e.printStackTrace();
\r
98 UIManager.setLookAndFeel(
\r
99 // "javax.swing.plaf.metal.MetalLookAndFeel"
\r
100 // "javax.swing.plaf.multi.MultiLookAndFeel"
\r
101 UIManager.getSystemLookAndFeelClassName()
\r
102 // UIManager.getCrossPlatformLookAndFeelClassName()
\r
103 // "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
\r
104 // "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
\r
105 // "com.sun.java.swing.plaf.motif.MotifLookAndFeel"
\r
108 catch (Exception ex)
\r
111 Desktop frame = new Desktop();
\r
112 frame.setResizable(true);
\r
113 frame.setVisible(true);
\r
117 if(args!=null && args.length>0)
\r
120 if(args[0].equals("-open"))
\r
125 String protocol = "File";
\r
126 if(file.indexOf("http:")>-1)
\r
129 String format = jalview.io.IdentifyFile.Identify(file, protocol);
\r
131 frame.LoadFile(file, protocol, format);
\r
134 if(jalview.gui.Preferences.showStartupFile &&
\r
135 jalview.gui.Preferences.startupFile!=null)
\r
137 String file = jalview.gui.Preferences.startupFile;
\r
138 String protocol = "File";
\r
139 if (file.indexOf("http:") > -1)
\r
142 if(file.endsWith(".jar"))
\r
143 Jalview2XML.LoadJalviewAlign(file);
\r
146 String format = jalview.io.IdentifyFile.Identify(file, protocol);
\r
147 frame.LoadFile(file, protocol, format);
\r