/******************** * 2004 Jalview Reengineered * Barton Group * Dundee University * * AM Waterhouse *******************/ package jalview.bin; import jalview.gui.*; import javax.swing.*; import java.awt.event.*; import jalview.io.*; 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.setProperty("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() { if(applet!=null) applet.stop(); else System.exit(0); frame.setVisible(false); } public static void main(String[] args) { Cache.loadProperties(); try{ UIManager.setLookAndFeel( // "javax.swing.plaf.metal.MetalLookAndFeel" // "javax.swing.plaf.multi.MultiLookAndFeel" // UIManager.getSystemLookAndFeelClassName() UIManager.getCrossPlatformLookAndFeelClassName() // "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" // "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" // "com.sun.java.swing.plaf.motif.MotifLookAndFeel" ); } catch (Exception ex) {} // JFrame.setDefaultLookAndFeelDecorated(true); Desktop frame = new Desktop(); frame.setResizable(true); frame.setVisible(true); if(args!=null && args.length>0) { String file = args[0]; String protocol = "File"; if(file.indexOf("http:")>-1) protocol = "URL"; String format = jalview.io.IdentifyFile.Identify(file, protocol); frame.LoadFile(file, protocol, format); } } }