Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6589530

HW/LW mixing code incorrectly handles insertion of components with the setComponentZOrder() method

    XMLWordPrintable

Details

    • b01
    • b21
    • generic, x86
    • generic, linux, windows_xp
    • Not verified

    Backports

      Description

        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);
            }
        }

        Attachments

          Issue Links

            Activity

              People

                anthony Anthony Petrov (Inactive)
                anthony Anthony Petrov (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: