[jsword-svn] r1325 - in trunk: bibledesktop/src/main/resources common-swing/src/main/java/org/crosswire/common/swing

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Wed May 16 14:16:52 MST 2007


Author: dmsmith
Date: 2007-05-16 14:16:51 -0700 (Wed, 16 May 2007)
New Revision: 1325

Modified:
   trunk/bibledesktop/src/main/resources/config.properties
   trunk/bibledesktop/src/main/resources/config.xml
   trunk/common-swing/src/main/java/org/crosswire/common/swing/LookAndFeelUtil.java
Log:
Added the ability to set an application font.

Modified: trunk/bibledesktop/src/main/resources/config.properties
===================================================================
--- trunk/bibledesktop/src/main/resources/config.properties	2007-05-16 20:27:20 UTC (rev 1324)
+++ trunk/bibledesktop/src/main/resources/config.properties	2007-05-16 21:16:51 UTC (rev 1325)
@@ -59,7 +59,7 @@
 Passages.BookCase.alternative.1=Sentence
 Passages.BookCase.alternative.2=UPPER
 Application.Language.path=Application.Language
-Application.Language.help=The language of the application.
+Application.Language.help=The language of the application. (Requires restart)
 Application.LookAndFeel.path=Application.Look and Feel
 Application.LookAndFeel.help=The look and feel of the application.
 Application.InitialLayout.path=Application.Initial Layout
@@ -70,6 +70,8 @@
 Application.MaxHeight.help=The maximum height you want the window to be
 Application.MaxWidth.path=Application.Maximum Window Width
 Application.MaxWidth.help=The maximum width you want the window to be
+Application.UIFont.path=Application.General Font
+Application.UIFont.help=The font for the application (Requires restart)
 Advanced.Raw.CacheData.path=Advanced.Raw.Cache Data
 Advanced.Raw.CacheData.help=Do new RawBibles cache the entire Bible in memory, or just the indexes.
 Advanced.Reports.ShowErrorsInDialogBox.path=Advanced.Reports.Show errors in a dialog box
@@ -86,8 +88,8 @@
 Advanced.Passage.DefaultType.alternative.1=Write Speed (Bitwise)
 Advanced.Passage.DefaultType.alternative.2=Size (Distinct)
 Advanced.Passage.DefaultType.alternative.3=Mix (Ranged)
-Advanced.AboutDialog.IncludeAdvancedTabs.path=Advanced.About Dialog.Include Advanced Tabs
-Advanced.AboutDialog.IncludeAdvancedTabs.help=Are the advanced tabs visible in the "About ..." Dialog. (Requires restart)
+Advanced.IncludeAdvancedTabs.path=Advanced.Include Advanced Tabs
+Advanced.IncludeAdvancedTabs.help=Are the advanced tabs visible in the "About ..." Dialog. (Requires restart)
 WebJournal.Url.path=Web Journal.Server URL
 WebJournal.Url.help=The URL for web journal's the web services interface.
 WebJournal.UserName.path=Web Journal.Account name

Modified: trunk/bibledesktop/src/main/resources/config.xml
===================================================================
--- trunk/bibledesktop/src/main/resources/config.xml	2007-05-16 20:27:20 UTC (rev 1324)
+++ trunk/bibledesktop/src/main/resources/config.xml	2007-05-16 21:16:51 UTC (rev 1325)
@@ -217,6 +217,10 @@
     <introspect class="org.crosswire.bibledesktop.desktop.Desktop" property="MaxHeight"/>
   </option>
 
+  <option key="Application.UIFont" type="font">
+    <introspect class="org.crosswire.common.swing.LookAndFeelUtil" property="Font"/>
+  </option>
+
 <!-- Currently not used
   <option key="Advanced.Raw.CacheData" type="boolean">
     <introspect class="org.crosswire.jsword.book.raw.RawBook" property="DefaultCacheData"/>
@@ -251,12 +255,12 @@
   </option>
 -->
 
-<!-- This really only useful for developers, they can uncomment it.-->
-  <option key="Advanced.AboutDialog.IncludeAdvancedTabs" type="boolean">
+<!-- This really only useful for developers, they can uncomment it.
+  <option key="Advanced.IncludeAdvancedTabs" type="boolean">
     <introspect class="org.crosswire.bibledesktop.desktop.AboutPane" property="Advanced"/>
   </option>
+-->
 
-
 <!--  Temporarily remove Blog code
   <option key="WebJournal.Url" type="string" priority="1">
     <introspect class="org.crosswire.bibledesktop.journal.BlogClientFrame" property="Url"/>

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/LookAndFeelUtil.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/LookAndFeelUtil.java	2007-05-16 20:27:20 UTC (rev 1324)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/LookAndFeelUtil.java	2007-05-16 21:16:51 UTC (rev 1325)
@@ -33,6 +33,7 @@
 import org.crosswire.common.swing.plaf.MetalLFCustoms;
 import org.crosswire.common.swing.plaf.OtherLFCustoms;
 import org.crosswire.common.swing.plaf.WindowsLFCustoms;
+import org.crosswire.common.util.StringUtil;
 
 /**
  * LookAndFeelUtil declares the Choices and actions
@@ -95,8 +96,35 @@
 
         currentLAF = newLaFClass;
     }
+    /**
+     * Accessor for the stylesheet we are transforming using
+     */
+    public static String getFont()
+    {
+        return font;
+    }
 
     /**
+     * Converts the font spec to something useful.
+     */
+    public static FontUIResource toFontUIResource()
+    {
+        String[] fontSpec = StringUtil.split(LookAndFeelUtil.font, ","); //$NON-NLS-1$
+        int fontStyle = Integer.parseInt(fontSpec[1]);
+        int fontSize = Integer.parseInt(fontSpec[2]);
+        return new FontUIResource(fontSpec[0], fontStyle, fontSize);
+    }
+
+    /**
+     * Accessor for the stylesheet we are transforming using
+     */
+    public static void setFont(String font)
+    {
+        LookAndFeelUtil.font = font;
+        setUIFont(toFontUIResource());
+    }
+
+    /**
      * Set the default font for all Swing components.
      * E.g. <code>setUIFont(new FontUIResource("Serif", Font.ITALIC, 12));</code>
      * <br/>Note: a single resources can be changed with:
@@ -130,6 +158,11 @@
     private static Class defaultLAF;
 
     /**
+     * The font to be used for the application
+     */
+    private static String font = "Dialog,0,12"; //$NON-NLS-1$
+
+    /**
      * Setup the default PLAF
      */
     static




More information about the jsword-svn mailing list