|
Duplicate :
|
|
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Duplicate :
|
The Container.setComponentZOrder(Component comp, int index) method may be used to insert components into a Container. In this case the oldIndex value that gets passed to the mixOnZOrderChanging() method is -1. This actually causes an exception with the following stack:
java.lang.ArrayIndexOutOfBoundsException: No such child: -1
at java.awt.Container.getComponent(Container.java:307)
at java.awt.Component.mixOnZOrderChanging(Component.java:9696)
at java.awt.Container.setComponentZOrder(Container.java:713)
The following test reproduces the problem.
import java.awt.*;
public class test {
public static void main(String[] args) {
Container c = new Container();
Button b = new Button("b");
c.setComponentZOrder(b, 0);
}
}
|