In said method, we use component.legth as boundary for our search. We really should use ncomponents, because we might have some empty space at the end of the array.
2006-06-22 Roman Kennke <[EMAIL PROTECTED]>
* java/awt/Container.java
(getComponentZOrder): Use ncomponents instead of
component.length so that we don't consider the empty space
after the last component.
/Roman
--
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: java/awt/Container.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.93
diff -u -2 -0 -r1.93 Container.java
--- java/awt/Container.java 30 May 2006 18:03:35 -0000 1.93
+++ java/awt/Container.java 23 Jun 2006 10:54:30 -0000
@@ -1668,41 +1668,41 @@
}
/**
* Returns the Z ordering index of <code>comp</code>. If <code>comp</code>
* is not a child component of this Container, this returns <code>-1</code>.
*
* @param comp the component for which to query the Z ordering
*
* @return the Z ordering index of <code>comp</code> or <code>-1</code> if
* <code>comp</code> is not a child of this Container
*
* @see #setComponentZOrder(Component, int)
*
* @since 1.5
*/
public final int getComponentZOrder(Component comp)
{
int index = -1;
if (component != null)
{
- for (int i = 0; i < component.length; i++)
+ for (int i = 0; i < ncomponents; i++)
{
if (component[i] == comp)
{
index = i;
break;
}
}
}
return index;
}
// Hidden helper methods.
/**
* Perform a graphics operation on the children of this container.
* For each applicable child, the visitChild() method will be called
* to perform the graphics operation.
*
* @param gfx The graphics object that will be used to derive new
* graphics objects for the children.
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
