[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Tue May 27 23:10:55 UTC 2008


kawas
Tue May 27 19:10:54 EDT 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory dev.open-bio.org:/tmp/cvs-serv11777/src/main/org/biomoby/service/dashboard

Modified Files:
	PerlMoSeSPanel.java 
Log Message:
*last font selected is saved
moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java	2008/05/27 20:08:37	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java	2008/05/27 23:10:54	1.6
@@ -130,6 +130,9 @@
     
     // String: the exact path to the users perl (in case it is not available on the path)
     static String PM_PERL_INSTALL_DIR = "perl-moses-perl-install-dir";
+    
+    // String: the font that the editor uses
+    static String PM_EDITOR_FONT = "perl-moses-editor-font";
 
     // generated serialversionUID
     private static final long serialVersionUID = 1379466985182986776L;
@@ -678,14 +681,30 @@
 	GraphicsEnvironment env =
 	    GraphicsEnvironment.getLocalGraphicsEnvironment();
 	String[] fontFamilies = env.getAvailableFontFamilyNames();
+	int index = 0;
+	String saved_font = getPrefValue(PM_EDITOR_FONT, "");
+	if (saved_font != null && !saved_font.trim().equals("")) {
+	    index = 0;
+	    for (String f:fontFamilies) {
+		if (f.equals(saved_font))
+		    break;
+		else
+		    index++;
+	    }
+	    Font oldFont = editorTextPane.getFont();
+	    Font font = new Font(saved_font, oldFont.getStyle(), oldFont.getSize());
+	    editorTextPane.setFont(font);
+	}
+	
 	// set up the combobox
 	fonts = new JComboBox(fontFamilies);
-	fonts.setSelectedIndex(0);
+	fonts.setSelectedIndex(index >= fontFamilies.length -1 ? 0 : index);
 	// add a listener
 	fonts.addItemListener(new ItemListener(){
 	    public void itemStateChanged(ItemEvent e) {
 		String newFont = (String)e.getItem();
 		Font oldFont = editorTextPane.getFont();
+		setPrefValue(PM_EDITOR_FONT, newFont);
 		Font font = new Font(newFont, oldFont.getStyle(), oldFont.getSize());
 		editorTextPane.setFont(font);
 	    }




More information about the MOBY-guts mailing list