[jsword-svn] r1315 - trunk/common-swing/src/main/java/org/crosswire/common/config/swing

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Sat May 5 05:31:23 MST 2007


Author: dmsmith
Date: 2007-05-05 05:31:23 -0700 (Sat, 05 May 2007)
New Revision: 1315

Modified:
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/OptionsField.java
Log:
Fixed a preferences/options problem where window was too wide, by defaulting preferred size to 100 pixels wide.


Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/OptionsField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/OptionsField.java	2007-05-04 20:44:27 UTC (rev 1314)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/OptionsField.java	2007-05-05 12:31:23 UTC (rev 1315)
@@ -21,6 +21,8 @@
  */
 package org.crosswire.common.config.swing;
 
+import java.awt.Dimension;
+
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.JComboBox;
 import javax.swing.JComponent;
@@ -38,7 +40,19 @@
  */
 public class OptionsField implements Field
 {
+
     /**
+     * Create an empty OptionsField
+     */
+    public OptionsField()
+    {
+        list = new String[0];
+        combo = new JComboBox(new String[] { Msg.NO_OPTIONS.toString() });
+        // Set the preferred width. Note, the actual combo box will resize to the width of it's container
+        combo.setPreferredSize(new Dimension(100, combo.getPreferredSize().height));
+    }
+
+    /**
      * Some fields will need some extra info to display properly
      * like the options in an options field. FieldMap calls this
      * method with options provided by the choice.
@@ -116,7 +130,7 @@
     /**
      * The component that we are wrapping in a field
      */
-    private JComboBox combo = new JComboBox(new String[] { Msg.NO_OPTIONS.toString() });
+    private JComboBox combo;
 
     /**
      * The options




More information about the jsword-svn mailing list