| 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.treestat; |
| 27 |
|
| 28 |
import dr.app.beast.BeastVersion; |
| 29 |
import dr.app.util.OSType; |
| 30 |
import dr.evolution.io.NexusImporter; |
| 31 |
import dr.util.Version; |
| 32 |
import jam.framework.SingleDocApplication; |
| 33 |
import jam.mac.Utils; |
| 34 |
|
| 35 |
import javax.swing.*; |
| 36 |
import java.awt.*; |
| 37 |
import java.util.Locale; |
| 38 |
|
| 39 |
public class TreeStatApp extends SingleDocApplication { |
| 40 |
|
| 41 |
private final static Version version = new BeastVersion(); |
| 42 |
|
| 43 |
public TreeStatApp(String nameString, String aboutString, Icon icon, String websiteURLString, String helpURLString) { |
| 44 |
super(nameString, aboutString, icon, websiteURLString, helpURLString); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
static public void main(String[] args) { |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
Locale.setDefault(Locale.US); |
| 53 |
|
| 54 |
|
| 55 |
NexusImporter.setSuppressWarnings(true); |
| 56 |
|
| 57 |
|
| 58 |
if (OSType.isMac()) { |
| 59 |
if (Utils.getMacOSXVersion().startsWith("10.5")) { |
| 60 |
System.setProperty("apple.awt.brushMetalLook","true"); |
| 61 |
} |
| 62 |
System.setProperty("apple.laf.useScreenMenuBar","true"); |
| 63 |
System.setProperty("apple.awt.showGrowBox","true"); |
| 64 |
UIManager.put("SystemFont", new Font("Lucida Grande", Font.PLAIN, 13)); |
| 65 |
UIManager.put("SmallSystemFont", new Font("Lucida Grande", Font.PLAIN, 11)); |
| 66 |
} |
| 67 |
|
| 68 |
try { |
| 69 |
|
| 70 |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
| 71 |
|
| 72 |
java.net.URL url = TreeStatApp.class.getResource("images/TreeStat.png"); |
| 73 |
Icon icon = null; |
| 74 |
|
| 75 |
if (url != null) { |
| 76 |
icon = new ImageIcon(url); |
| 77 |
} |
| 78 |
|
| 79 |
final String versionString = version.getVersionString(); |
| 80 |
String nameString = "TreeStat " + versionString; |
| 81 |
String aboutString = "<html><center><p>Tree Statistic Calculation Tool<br>" + |
| 82 |
versionString + ", " + version.getDateString() + "</p>" + |
| 83 |
|
| 84 |
"<p>by<br>" + |
| 85 |
"Andrew Rambaut and Alexei J. Drummond</p>" + |
| 86 |
"<p>Institute of Evolutionary Biology, University of Edinburgh<br>" + |
| 87 |
"<a href=\"mailto:[email protected]\">[email protected]</a></p>" + |
| 88 |
"<p>Department of Computer Science, University of Auckland<br>" + |
| 89 |
"<a href=\"mailto:[email protected]\">[email protected]</a></p>" + |
| 90 |
"<p>Visit the BEAST page:<br>" + |
| 91 |
"<a href=\"http://beast.community\">http://beast.community</a></p>" + |
| 92 |
"</center></html>"; |
| 93 |
|
| 94 |
String websiteURLString = "http://beast.community"; |
| 95 |
String helpURLString = "http://beast.community/TreeStat"; |
| 96 |
|
| 97 |
TreeStatApp app = new TreeStatApp(nameString, aboutString, icon, |
| 98 |
websiteURLString, helpURLString); |
| 99 |
app.setDocumentFrame(new TreeStatFrame(app, nameString)); |
| 100 |
app.initialize(); |
| 101 |
|
| 102 |
} catch (Exception e) { |
| 103 |
JOptionPane.showMessageDialog(new JFrame(), "Fatal exception: " + e, |
| 104 |
"Please report this to the authors", |
| 105 |
JOptionPane.ERROR_MESSAGE); |
| 106 |
e.printStackTrace(); |
| 107 |
} |
| 108 |
} |
| 109 |
} |