| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.app.treespace; |
| 27 |
|
| 28 |
import jam.framework.*; |
| 29 |
import jam.mac.Utils; |
| 30 |
|
| 31 |
import javax.swing.*; |
| 32 |
import java.awt.*; |
| 33 |
import java.io.File; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
public class TreeSpaceApp extends MultiDocApplication { |
| 40 |
|
| 41 |
public TreeSpaceApp(String nameString, String aboutString, Icon icon, |
| 42 |
String websiteURLString, String helpURLString) { |
| 43 |
super(new TreeSpaceMenuBarFactory(), nameString, aboutString, icon, websiteURLString, helpURLString); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
public Action getOpenAction() { |
| 53 |
throw new UnsupportedOperationException("getOpenAction is not supported"); |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
static public void main(String[] args) { |
| 58 |
|
| 59 |
boolean lafLoaded = false; |
| 60 |
|
| 61 |
if (Utils.isMacOSX()) { |
| 62 |
System.setProperty("apple.awt.graphics.UseQuartz", "true"); |
| 63 |
System.setProperty("apple.awt.antialiasing","true"); |
| 64 |
System.setProperty("apple.awt.rendering","VALUE_RENDER_QUALITY"); |
| 65 |
|
| 66 |
System.setProperty("apple.laf.useScreenMenuBar","true"); |
| 67 |
System.setProperty("apple.awt.draggableWindowBackground","true"); |
| 68 |
System.setProperty("apple.awt.showGrowBox","true"); |
| 69 |
|
| 70 |
|
| 71 |
try { |
| 72 |
UIManager.setLookAndFeel( |
| 73 |
"ch.randelshofer.quaqua.QuaquaLookAndFeel" |
| 74 |
); |
| 75 |
lafLoaded = true; |
| 76 |
|
| 77 |
|
| 78 |
} catch (Exception e) { |
| 79 |
|
| 80 |
} |
| 81 |
|
| 82 |
UIManager.put("SystemFont", new Font("Lucida Grande", Font.PLAIN, 13)); |
| 83 |
UIManager.put("SmallSystemFont", new Font("Lucida Grande", Font.PLAIN, 11)); |
| 84 |
} |
| 85 |
|
| 86 |
try { |
| 87 |
|
| 88 |
if (!lafLoaded) { |
| 89 |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
| 90 |
} |
| 91 |
|
| 92 |
java.net.URL url = TreeSpaceApp.class.getResource("images/phylogeography.png"); |
| 93 |
Icon icon = null; |
| 94 |
|
| 95 |
if (url != null) { |
| 96 |
icon = new ImageIcon(url); |
| 97 |
} |
| 98 |
|
| 99 |
final String nameString = "TreeSpace"; |
| 100 |
final String versionString = "v1.0"; |
| 101 |
String aboutString = "<html><div style=\"font-family:sans-serif;\"><center>" + |
| 102 |
"<div style=\"font-size:12;\"><p>Phylogenetic Tree Space Exploration<br>" + |
| 103 |
"Version " + versionString + ", 2009</p>" + |
| 104 |
"<p>by Andrew Rambaut</p></div>" + |
| 105 |
"</div></html>"; |
| 106 |
|
| 107 |
String websiteURLString = "http://beast.community"; |
| 108 |
String helpURLString = "http://beast.community/phylogeography"; |
| 109 |
|
| 110 |
TreeSpaceApp app = new TreeSpaceApp(nameString, aboutString, icon, |
| 111 |
websiteURLString, helpURLString); |
| 112 |
app.setDocumentFrameFactory(new DocumentFrameFactory() { |
| 113 |
public DocumentFrame createDocumentFrame(final Application application, final MenuBarFactory menuBarFactory) { |
| 114 |
return new TreeSpaceFrame(nameString); |
| 115 |
} |
| 116 |
}); |
| 117 |
app.initialize(); |
| 118 |
app.doNew(); |
| 119 |
|
| 120 |
if (args.length > 0) { |
| 121 |
for (String fileName : args) { |
| 122 |
((TreeSpaceFrame)app.getUpperDocumentFrame()).importDataFile(new File(fileName)); |
| 123 |
} |
| 124 |
} |
| 125 |
|
| 126 |
} catch (Exception e) { |
| 127 |
JOptionPane.showMessageDialog(new JFrame(), "Fatal exception: " + e, |
| 128 |
"Please report this to the authors", |
| 129 |
JOptionPane.ERROR_MESSAGE); |
| 130 |
e.printStackTrace(); |
| 131 |
} |
| 132 |
|
| 133 |
} |
| 134 |
|
| 135 |
} |