[kaffe] CVS kaffe (robilad): resynced with gnu classpath: box layout fix

Kaffe CVS cvs-commits at kaffe.org
Tue Mar 8 13:58:45 PST 2005


PatchSet 5503 
Date: 2005/03/08 21:52:43
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
resynced with gnu classpath: box layout fix

2005-03-08  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-03-03  Roman Kennke  <roman at ontographics.com>

        * javax/swing/BoxLayout.java:
        (preferredLayoutSize,minimumLayoutSize,maximumLayoutSize,
        layoutContainer): Make these methods and thereby the
        BoxLayout respect the insets (like borders) of the
        component that is laid out.

Members: 
	ChangeLog:1.3677->1.3678 
	libraries/javalib/javax/swing/BoxLayout.java:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3677 kaffe/ChangeLog:1.3678
--- kaffe/ChangeLog:1.3677	Tue Mar  8 21:48:32 2005
+++ kaffe/ChangeLog	Tue Mar  8 21:52:43 2005
@@ -2,6 +2,18 @@
 
 	Resynced with GNU Classpath.
 
+	2005-03-03  Roman Kennke  <roman at ontographics.com>
+
+        * javax/swing/BoxLayout.java:
+        (preferredLayoutSize,minimumLayoutSize,maximumLayoutSize,
+        layoutContainer): Make these methods and thereby the
+        BoxLayout respect the insets (like borders) of the
+        component that is laid out.
+
+2005-03-08  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-03-03  Jeroen Frijters  <jeroen at frijters.net>
 
         * java/lang/InheritableThreadLocal.java
Index: kaffe/libraries/javalib/javax/swing/BoxLayout.java
diff -u kaffe/libraries/javalib/javax/swing/BoxLayout.java:1.2 kaffe/libraries/javalib/javax/swing/BoxLayout.java:1.3
--- kaffe/libraries/javalib/javax/swing/BoxLayout.java:1.2	Sun Aug  8 19:46:02 2004
+++ kaffe/libraries/javalib/javax/swing/BoxLayout.java	Tue Mar  8 21:52:48 2005
@@ -42,6 +42,7 @@
 import java.awt.ComponentOrientation;
 import java.awt.Container;
 import java.awt.Dimension;
+import java.awt.Insets;
 import java.awt.LayoutManager2;
 import java.io.Serializable;
 
@@ -146,8 +147,9 @@
     if (parent != container)
       throw new AWTError("invalid parent");
 
-    int x = 0;
-    int y = 0;
+    Insets insets = parent.getInsets();
+    int x = insets.left + insets.right;
+    int y = insets.bottom + insets.top;
 
     Component[] children = parent.getComponents();
 
@@ -191,8 +193,9 @@
     if (parent != container)
       throw new AWTError("invalid parent");
 
-    int x = 0;
-    int y = 0;
+    Insets insets = parent.getInsets();
+    int x = insets.left + insets.right;
+    int y = insets.bottom + insets.top;
 
     Component[] children = parent.getComponents();
 
@@ -235,26 +238,30 @@
       throw new AWTError("invalid parent");
 
     Dimension size = parent.getSize();
-
+    Insets insets = parent.getInsets();
+    Dimension innerSize = new Dimension(size.width - insets.left
+                                        - insets.right, size.height
+                                        - insets.bottom - insets.top);
     Component[] children = parent.getComponents();
 
     if (isHorizontalIn(parent))
       {
-        int x = 0;
+        int x = insets.left;
         for (int index = 0; index < children.length; index++)
           {
             Component comp = children[index];
             Dimension sz = comp.getPreferredSize();
             int width = sz.width;
             int height = sz.height;
-            int cy = 0;
-            if (height > size.height)
+            int cy = insets.top;
+            if (height > innerSize.height)
               {
-                height = size.height;
+                height = innerSize.height;
               }
             else
               {
-                cy = (int) ((size.height - height) * comp.getAlignmentY());
+                cy = (int) ((innerSize.height - height)
+                            * comp.getAlignmentY());
               }
             
             comp.setSize(width, height);
@@ -264,21 +271,21 @@
       }
     else
       {
-        int y = 0;        
+        int y = insets.top;        
         for (int index = 0; index < children.length; index++)
           {
             Component comp = children[index];
             Dimension sz = comp.getPreferredSize();
             int width = sz.width;
             int height = sz.height;
-            int cx = 0;
-            if (width > size.width)
+            int cx = insets.left;
+            if (width > innerSize.width)
               {
-                width = size.width;
+                width = innerSize.width;
               }
             else
               {
-                cx = (int) ((size.width - width) * comp.getAlignmentX());
+                cx = (int) ((innerSize.width - width) * comp.getAlignmentX());
               }
             
             comp.setSize(width, height);
@@ -352,8 +359,9 @@
     if (parent != container)
       throw new AWTError("invalid parent");
 
-    int x = 0;
-    int y = 0;
+    Insets insets = parent.getInsets();
+    int x = insets.left + insets.right;
+    int y = insets.top + insets.bottom;
 
     Component[] children = parent.getComponents();
 




More information about the kaffe mailing list