Save fonts for trees
authoramwaterhouse <Andrew Waterhouse>
Wed, 14 Sep 2005 11:22:27 +0000 (11:22 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 14 Sep 2005 11:22:27 +0000 (11:22 +0000)
src/jalview/gui/Jalview2XML.java

index c524b39..bb95476 100755 (executable)
@@ -221,7 +221,9 @@ public class Jalview2XML
                   tree.setThreshold(tp.treeCanvas.threshold);\r
 \r
                   tree.setFitToWindow(tp.fitToWindow.getState());\r
-                  tree.setFontSize(tp.treeCanvas.fontSize);\r
+                  tree.setFontName(tp.getFont().getName());\r
+                  tree.setFontSize(tp.getFont().getSize());\r
+                  tree.setFontStyle(tp.getFont().getStyle());\r
                   tree.setMarkUnlinked(tp.placeholdersMenu.getState());\r
                   tree.setShowBootstrap(tp.bootstrapMenu.getState());\r
                   tree.setShowDistances(tp.distanceMenu.getState());\r
@@ -528,14 +530,25 @@ public class Jalview2XML
             }\r
             while (jarentry != null);\r
         }\r
+        catch(java.net.UnknownHostException ex)\r
+        {\r
+          ex.printStackTrace();\r
+          System.err.println("Couldn't locate Jalview XML file : " +\r
+              ex + "\n");\r
+           JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                    "Couldn't locate " + file,\r
+                                    "URL not found",\r
+                                    JOptionPane.WARNING_MESSAGE);\r
+\r
+        }\r
         catch (Exception ex)\r
         {\r
           ex.printStackTrace();\r
             System.err.println("Exception whilst loading jalview XML file : " +\r
                 ex + "\n");\r
              JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                      "Couldn't locate " + file,\r
-                                      "URL not found",\r
+                                      "Error loading  " + file,\r
+                                      "Error loading Jalview file",\r
                                       JOptionPane.WARNING_MESSAGE);\r
 \r
         }\r
@@ -775,8 +788,17 @@ public class Jalview2XML
 \r
                     tp.fitToWindow.setState(tree.getFitToWindow());\r
                     tp.fitToWindow_actionPerformed(null);\r
-                    tp.treeCanvas.fontSize = tree.getFontSize();\r
-                    tp.fontSize.setText("Font Size - " + tree.getFontSize());\r
+\r
+                    if(tree.getFontName()!=null)\r
+                      tp.setFont(new java.awt.Font(tree.getFontName(),\r
+                                          tree.getFontStyle(),\r
+                                          tree.getFontSize()));\r
+                    else\r
+                      tp.setFont(new java.awt.Font(view.getFontName(),\r
+                                            view.getFontStyle(),\r
+                                            tree.getFontSize()));\r
+\r
+\r
                     tp.placeholdersMenu.setState(tree.getMarkUnlinked());\r
                     tp.placeholdersMenu_actionPerformed(null);\r
                     tp.bootstrapMenu.setState(tree.getShowBootstrap());\r