Revision: 5375
          http://sourceforge.net/p/jump-pilot/code/5375
Author:   michaudm
Date:     2017-03-14 23:01:32 +0000 (Tue, 14 Mar 2017)
Log Message:
-----------
improve how MultiInputDialog is resized (let JTextArea increase its size)

Modified Paths:
--------------
    core/trunk/ChangeLog
    
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java
    core/trunk/src/com/vividsolutions/jump/workbench/ui/MultiInputDialog.java

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2017-03-14 22:22:30 UTC (rev 5374)
+++ core/trunk/ChangeLog        2017-03-14 23:01:32 UTC (rev 5375)
@@ -4,7 +4,8 @@
 #<-------------------------------- 80 chars 
---------------------------------->#
 
 2017-03-14 mmichaud <[email protected]>
-  *  upgrade to jumpjgrapht 0.7.1 (fix a bug related to empty geometries)
+  * upgrade to jumpjgrapht 0.7.1 (fix a bug related to empty geometries)
+  * improve how MultiInputDialog is resized (let JTextArea increase its size)
 
 2017-03-13 mmichaud <[email protected]>
   * Small improvements in UpdateWithJoinPlugIn

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java
===================================================================
--- 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java
   2017-03-14 22:22:30 UTC (rev 5374)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/ui/AbstractMultiInputDialog.java
   2017-03-14 23:01:32 UTC (rev 5375)
@@ -968,7 +968,7 @@
         JTextArea textArea = new JTextArea(initialValue, rowNumber, 
columnNumber);
         if (scrollable) component = new JScrollPane(textArea);
         else component = textArea;
-        addRow(fieldName, new JLabel(fieldName), component, enableChecks, 
toolTipText, LEFT_LABEL, HORIZONTAL);
+        addRow(fieldName, new JLabel(fieldName), component, enableChecks, 
toolTipText, LEFT_LABEL, BOTH);
         return textArea;
     }
     

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/MultiInputDialog.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/workbench/ui/MultiInputDialog.java   
2017-03-14 22:22:30 UTC (rev 5374)
+++ core/trunk/src/com/vividsolutions/jump/workbench/ui/MultiInputDialog.java   
2017-03-14 23:01:32 UTC (rev 5375)
@@ -45,6 +45,7 @@
 import javax.swing.*;
 import javax.swing.border.BevelBorder;
 import javax.swing.border.Border;
+import javax.swing.text.JTextComponent;
 
 import com.vividsolutions.jts.util.Assert;
 import com.vividsolutions.jump.feature.AttributeType;
@@ -280,7 +281,10 @@
                           int fillMode) {
         // register with parent
         addComponent(fieldName, label, component);
-
+        double weighty = 0.1;
+        if (component instanceof JTextArea) weighty = 1.0;
+        if (component instanceof JTextPane) weighty = 1.0;
+        if (component instanceof JScrollPane) weighty = 1.0;
         if (label != null && toolTipText != null) {
           label.setToolTipText(toolTipText);
           component.setToolTipText(toolTipText);
@@ -292,7 +296,7 @@
         
         if (labelPos == NO_LABEL) {
             currentPanel.add(component,
-                new GridBagConstraints(1, rowCount, 3, 1, 1.0, 1.0,
+                new GridBagConstraints(1, rowCount, 3, 1, 1.0, weighty,
                 GridBagConstraints.WEST, fillMode,
                 new Insets(5+inset, 2+inset, 2+inset, 2+inset), 0, 0));
         }
@@ -299,23 +303,23 @@
         else if (labelPos == LEFT_LABEL) {
             if (label != null) {
                 currentPanel.add(label,
-                        new GridBagConstraints(1, rowCount, 1, 1, 1.0, 1.0,
+                        new GridBagConstraints(1, rowCount, 1, 1, 0.0, weighty,
                                 GridBagConstraints.WEST, 
GridBagConstraints.NONE,
                                 new Insets(2+inset, 2+inset, 2+inset, 
2+inset), 0, 0));
             }
             currentPanel.add(component,
-                new GridBagConstraints(2, rowCount, 2, 1, 1.0, 1.0,
+                new GridBagConstraints(2, rowCount, 2, 1, 1.0, weighty,
                 GridBagConstraints.WEST, fillMode,
                 new Insets(2+inset, 2+inset, 2+inset, 2+inset), 0, 0));
         }
         else if (labelPos == RIGHT_LABEL) {
             currentPanel.add(component,
-                new GridBagConstraints(1, rowCount, 2, 1, 1.0, 1.0,
+                new GridBagConstraints(1, rowCount, 2, 1, 1.0, weighty,
                 GridBagConstraints.WEST, fillMode,
                 new Insets(2+inset, 2+inset, 2+inset, 2+inset), 0, 0));
             if (label != null) {
                 currentPanel.add(label,
-                        new GridBagConstraints(3, rowCount, 1, 1, 1.0, 1.0,
+                        new GridBagConstraints(3, rowCount, 1, 1, 0.0, weighty,
                                 GridBagConstraints.WEST, 
GridBagConstraints.NONE,
                                 new Insets(2+inset, 2+inset, 2+inset, 
2+inset), 0, 0));
             }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to