From db192b1f4421a83083929d95f3c6e4a6fb16e7b2 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 14 Sep 2005 11:22:27 +0000 Subject: [PATCH] Save fonts for trees --- src/jalview/gui/Jalview2XML.java | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index c524b39..bb95476 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -221,7 +221,9 @@ public class Jalview2XML tree.setThreshold(tp.treeCanvas.threshold); tree.setFitToWindow(tp.fitToWindow.getState()); - tree.setFontSize(tp.treeCanvas.fontSize); + tree.setFontName(tp.getFont().getName()); + tree.setFontSize(tp.getFont().getSize()); + tree.setFontStyle(tp.getFont().getStyle()); tree.setMarkUnlinked(tp.placeholdersMenu.getState()); tree.setShowBootstrap(tp.bootstrapMenu.getState()); tree.setShowDistances(tp.distanceMenu.getState()); @@ -528,14 +530,25 @@ public class Jalview2XML } while (jarentry != null); } + catch(java.net.UnknownHostException ex) + { + ex.printStackTrace(); + System.err.println("Couldn't locate Jalview XML file : " + + ex + "\n"); + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Couldn't locate " + file, + "URL not found", + JOptionPane.WARNING_MESSAGE); + + } catch (Exception ex) { ex.printStackTrace(); System.err.println("Exception whilst loading jalview XML file : " + ex + "\n"); JOptionPane.showInternalMessageDialog(Desktop.desktop, - "Couldn't locate " + file, - "URL not found", + "Error loading " + file, + "Error loading Jalview file", JOptionPane.WARNING_MESSAGE); } @@ -775,8 +788,17 @@ public class Jalview2XML tp.fitToWindow.setState(tree.getFitToWindow()); tp.fitToWindow_actionPerformed(null); - tp.treeCanvas.fontSize = tree.getFontSize(); - tp.fontSize.setText("Font Size - " + tree.getFontSize()); + + if(tree.getFontName()!=null) + tp.setFont(new java.awt.Font(tree.getFontName(), + tree.getFontStyle(), + tree.getFontSize())); + else + tp.setFont(new java.awt.Font(view.getFontName(), + view.getFontStyle(), + tree.getFontSize())); + + tp.placeholdersMenu.setState(tree.getMarkUnlinked()); tp.placeholdersMenu_actionPerformed(null); tp.bootstrapMenu.setState(tree.getShowBootstrap()); -- 1.7.10.2