Debian Codegraph @

src/dr/app/treestat/TreeStatApp.java

raw symbols SCIP
1 /*
2 * TreeStatApp.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
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 // Main entry point
48 static public void main(String[] args) {
49
50 // There is a major issue with languages that use the comma as a decimal separator.
51 // To ensure compatibility between programs in the package, enforce the US locale.
52 Locale.setDefault(Locale.US);
53
54 // don't display warnings from NexusImporter as they are only relevant to Beast-MCMC-1.x
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 // "Version 1.2, 2005-2010</p>" +
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 }