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

Undefined behavior of BorderLayout when component changes constraints

XMLWordPrintable

    • Cause Known
    • x86
    • windows_xp

      This bug came from the 4950972 bug.

      The problem is that this:

        container.add(component, BorderLayout.NORTH);

      is not quite the same as:

        container.add(component);
        container.getLayout().addLayoutComponent(BorderLayout.NORTH,component);

      The latter is what the XMLEncoder creates for the former.
      The latter is equivalent to:

        container.add(BorderLayout.CENTER,component);
        container.getLayout().addLayoutComponent(BorderLayout.NORTH,component);

      The problem is that the same component is both the CENTER and the NORTH component in the BorderLayout! BorderLayout assigns bounds to the NORTH first and then to the CENTER; our poor component gets its bounds set twice and lands in the center, with space taken in the east for a phantom version.

            dav Andrei Dmitriev (Inactive)
            malenkov Sergey Malenkov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: