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

update Component#remove() javadoc to reflect need to call revalidate()

XMLWordPrintable

    • b75
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      According to this bug:
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4130347
      , and my own experience, calling java.awt.Component#remove(*) to remove a component requires a call to revalidate() or validate().

      It's not a bug report per se, rather a RFE that the requirements
      of the remove() calls be explicitly noted in the javadoc so that
      people don't get bitten by this.

      I only very occasionally produce code that ever does a
      Component#remove()
      Component#add()
      sequence.

      But every time I have, it has been a frustrating experience.
      First the code seem to work. Then it doesn't work under odd
      situations. Then it does an incompletel repaint.
      Eventually..... I either remember or find some comment somewhere about
      needing to do a
      validate()
      repaint()
      sequence, and then everything works fine.

      If the remove() methods just had a comment along the lines of:
      "Client code should call revalidate() and repaint() after completing
      modications to the list of child components".
      Then that would be one less swing quirk that I have to keep running into.


      JUSTIFICATION :
      I have been bitten by this a couple of times because it can sometimes work and then mysteriously not work.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      It would be useful if the remove()/add() javadoc explicitly stated the requirement.

            dav Andrei Dmitriev (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: