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

confusing doc for JLayeredPane getPosition and setPosition

    Details

      Description

      FULL PRODUCT VERSION :
      http://java.sun.com/javase/6/docs/api/javax/swing/JLayeredPane.html#setPosition(java.awt.Component,%20int)

      A DESCRIPTION OF THE PROBLEM :
      setPosition says, "Moves the component to position within its current layer, where 0 is the topmost position within the layer and -1 is the bottommost position." but also says, "position - an int in the range -1..N-1, where N is the number of components in the component's current layer". In other words topmost is 0 only if there are two things in the layer?

      getPosition says, "Returns: an int giving the component's position, where 0 is the topmost position and the highest index value = the count count of components at that layer, minus 1". If 0 is topmost, then what does "highest index" mean?

      Sounds like three different numbering schemes:
      -1 (bottom) through 0 (top)
      0 (bottom) through N-1 (top)
      N-1 (bottom) through 0 (top)

      Seems to me this needs a rewrite.


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ryeung Roger Yeung (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: