/[classpath]/classpath/javax/swing/BoxLayout.java
ViewVC logotype

Diff of /classpath/javax/swing/BoxLayout.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6.2.2 by gnu_andrew, Mon Apr 18 01:37:39 2005 UTC revision 1.6.2.3 by gnu_andrew, Thu Apr 28 23:00:13 2005 UTC
# Line 1  Line 1 
1  /* BoxLayout.java -- A layout for swing components.  /* BoxLayout.java -- A layout for swing components.
2     Copyright (C) 2002, 2003 Free Software Foundation, Inc.     Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 148  public class BoxLayout implements Layout Line 148  public class BoxLayout implements Layout
148        throw new AWTError("invalid parent");        throw new AWTError("invalid parent");
149    
150      Insets insets = parent.getInsets();      Insets insets = parent.getInsets();
151      int x = insets.left + insets.right;      int x = 0;
152      int y = insets.bottom + insets.top;      int y = 0;
153    
154      Component[] children = parent.getComponents();      Component[] children = parent.getComponents();
155    
156      if (isHorizontalIn(parent))      if (isHorizontalIn(parent))
157        {                {        
158            x = insets.left + insets.right;
159          // sum up preferred widths of components, find maximum of preferred          // sum up preferred widths of components, find maximum of preferred
160          // heights          // heights
161          for (int index = 0; index < children.length; index++)          for (int index = 0; index < children.length; index++)
# Line 164  public class BoxLayout implements Layout Line 165  public class BoxLayout implements Layout
165              x += sz.width;              x += sz.width;
166              y = Math.max(y, sz.height);              y = Math.max(y, sz.height);
167            }            }
168            y += insets.bottom + insets.top;
169        }        }
170      else      else
171        {                {        
172            y = insets.top + insets.bottom;
173          // sum up preferred heights of components, find maximum of          // sum up preferred heights of components, find maximum of
174          //  preferred widths          //  preferred widths
175          for (int index = 0; index < children.length; index++)          for (int index = 0; index < children.length; index++)
# Line 176  public class BoxLayout implements Layout Line 179  public class BoxLayout implements Layout
179              y += sz.height;              y += sz.height;
180              x = Math.max(x, sz.width);              x = Math.max(x, sz.width);
181            }            }
182            x += insets.left + insets.right;
183        }        }
184        
185      return new Dimension(x, y);      return new Dimension(x, y);
186    }    }
187    

Legend:
Removed from v.1.6.2.2  
changed lines
  Added in v.1.6.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26