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

Undefined behavior of BorderLayout when component changes constraints

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Imported:
                Indexed: