In the SizeSequence constructor we must initialize the array with the
correct size.

2006-06-21  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/SizeSequence.java
        (SizeSequence): Initialize array with correct number of entries.

/Roman

-- 
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/SizeSequence.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/SizeSequence.java,v
retrieving revision 1.4
diff -u -1 -0 -r1.4 SizeSequence.java
--- javax/swing/SizeSequence.java	9 Apr 2006 19:57:14 -0000	1.4
+++ javax/swing/SizeSequence.java	21 Jun 2006 12:41:48 -0000
@@ -30,20 +30,22 @@
 terms of your choice, provided that you also meet, for each linked
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
 package javax.swing;
 
+import java.util.Arrays;
+
 /**
  * A sequence of values that represent the dimensions (widths or heights) of 
  * some collection of items (for example, the widths of the columns in a table).
  * 
  * @author	Andrew Selkirk
  */
 public class SizeSequence
 {
   // TODO: Sun's API specification for this class contains an implementation
   // note regarding the encoding for the element sizes.  We currently use the
@@ -73,22 +75,22 @@
 
   /**
    * Creates a new <code>SizeSequence</code> instance with the specified number
    * of elements all having the same size (<code>value</code>).
    * 
    * @param numEntries  the number of elements.
    * @param value  the value for each element.
    */
   public SizeSequence(int numEntries, int value)
   {
-    sizes = new int[0];
-    insertEntries(0, numEntries, value);
+    sizes = new int[numEntries];
+    Arrays.fill(sizes, value);
   }
 
   /**
    * Creates a new <code>SizeSequence</code> instance using the specified 
    * element sizes.
    * 
    * @param sizes  the element sizes (<code>null</code> not permitted).
    */
   public SizeSequence(int[] sizes)
   {

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to