[jsword-svn] r1544 - in trunk/common-swing/src/main/java/org/crosswire/common: config/swing swing

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Wed Jul 25 14:28:23 MST 2007


Author: dmsmith
Date: 2007-07-25 14:28:23 -0700 (Wed, 25 Jul 2007)
New Revision: 1544

Modified:
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/FontChooser.java
   trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java
Log:
Fixed the orientation of the config wizards to follow component orientation.

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java	2007-07-25 20:10:16 UTC (rev 1543)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/AbstractConfigEditor.java	2007-07-25 21:28:23 UTC (rev 1544)
@@ -86,6 +86,7 @@
 
         updateTree();
 
+        GuiUtil.applyDefaultOrientation(this);
         SwingUtilities.updateComponentTreeUI(this);
     }
 
@@ -116,6 +117,8 @@
         GuiUtil.centerWindow(dialog);
         dialog.setModal(true);
 
+        GuiUtil.applyDefaultOrientation(dialog);
+
         // show
         dialog.setVisible(true);
     }

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java	2007-07-25 20:10:16 UTC (rev 1543)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/StringArrayField.java	2007-07-25 21:28:23 UTC (rev 1544)
@@ -24,6 +24,9 @@
 import java.awt.BorderLayout;
 import java.awt.FlowLayout;
 import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 
@@ -43,7 +46,6 @@
 import org.crosswire.common.config.Choice;
 import org.crosswire.common.swing.ActionFactory;
 import org.crosswire.common.swing.CWScrollPane;
-import org.crosswire.common.swing.FieldLayout;
 import org.crosswire.common.util.Convert;
 
 /**
@@ -71,7 +73,6 @@
 
         list.setFont(new Font("Monospaced", Font.PLAIN, 12)); //$NON-NLS-1$
         list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        // list.setPreferredScrollableViewportSize(new Dimension(30, 100));
 
         JScrollPane scroll = new CWScrollPane(list);
 
@@ -217,12 +218,23 @@
          */
         public InputPane()
         {
-            super(new FieldLayout(10, 10));
+            super(new GridBagLayout());
 
-            add(new JLabel(Msg.NAME.toString() + ':'));
-            add(name_field);
+            GridBagConstraints c = new GridBagConstraints();
+            c.anchor = GridBagConstraints.LINE_END;
+            c.insets = new Insets(0, 5, 0, 5);
 
-            setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+            c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
+            c.fill = GridBagConstraints.NONE;      //reset to default
+            c.weightx = 0.0;                       //reset to default
+            add(new JLabel(Msg.NAME.toString() + ':'), c);
+
+            c.gridwidth = GridBagConstraints.REMAINDER;     //end row
+            c.fill = GridBagConstraints.HORIZONTAL;
+            c.weightx = 1.0;
+            add(name_field, c);
+
+            setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
         }
 
         /**

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java	2007-07-25 20:10:16 UTC (rev 1543)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/TreeConfigEditor.java	2007-07-25 21:28:23 UTC (rev 1544)
@@ -49,6 +49,7 @@
 import org.crosswire.common.config.Config;
 import org.crosswire.common.swing.CWScrollPane;
 import org.crosswire.common.swing.FormPane;
+import org.crosswire.common.swing.GuiUtil;
 
 /**
  * A Tabbed view of a config class.
@@ -130,6 +131,7 @@
 
         add(BorderLayout.CENTER, panel);
         add(BorderLayout.SOUTH, new ButtonPane(this));
+        GuiUtil.applyDefaultOrientation(this);
     }
 
     /**

Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java	2007-07-25 20:10:16 UTC (rev 1543)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/WizardConfigEditor.java	2007-07-25 21:28:23 UTC (rev 1544)
@@ -51,6 +51,7 @@
 import org.crosswire.common.swing.CWScrollPane;
 import org.crosswire.common.swing.EdgeBorder;
 import org.crosswire.common.swing.FormPane;
+import org.crosswire.common.swing.GuiUtil;
 import org.crosswire.common.util.Logger;
 
 /**
@@ -108,7 +109,7 @@
 
         add(panel, BorderLayout.CENTER);
         add(getButtonPane(), BorderLayout.PAGE_END);
-
+        GuiUtil.applyDefaultOrientation(this);
     }
 
     /**

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/FontChooser.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/FontChooser.java	2007-07-25 20:10:16 UTC (rev 1543)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/FontChooser.java	2007-07-25 21:28:23 UTC (rev 1544)
@@ -89,7 +89,7 @@
         italic.setSelected(font.isItalic());
         italic.addItemListener(changer);
 
-        setLayout(new GridLayout(2, 2));
+        setLayout(new GridLayout(2, 2, 5, 5));
 
         add(name);
         add(size);

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java	2007-07-25 20:10:16 UTC (rev 1543)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/FormPane.java	2007-07-25 21:28:23 UTC (rev 1544)
@@ -22,6 +22,9 @@
 package org.crosswire.common.swing;
 
 import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
 import java.util.Hashtable;
 
 import javax.swing.BorderFactory;
@@ -42,8 +45,9 @@
      */
     public FormPane()
     {
-        setLayout(new FieldLayout(15, 20));
+        setLayout(new GridBagLayout());
         setBorder(BorderFactory.createEmptyBorder());
+        GuiUtil.applyDefaultOrientation(this);
     }
 
     /**
@@ -56,9 +60,20 @@
         JLabel label = new JLabel(prompt);
         label.setToolTipText(tooltip);
 
-        add(label);
-        add(comp);
+        GridBagConstraints c = new GridBagConstraints();
+        c.anchor = GridBagConstraints.LINE_END;
+        c.insets = new Insets(5, 5, 5, 5);
 
+        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
+        c.fill = GridBagConstraints.NONE;      //reset to default
+        c.weightx = 0.0;                       //reset to default
+        add(label, c);
+
+        c.gridwidth = GridBagConstraints.REMAINDER;     //end row
+        c.fill = GridBagConstraints.HORIZONTAL;
+        c.weightx = 1.0;
+        add(comp, c);
+
         comps.put(prompt + SUFFIX_LABEL, label);
         comps.put(prompt + SUFFIX_COMP, comp);
     }




More information about the jsword-svn mailing list