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

JList.getPreferredScrollableViewportSize(): fix mistake in doc for height calc

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 11
    • client-libs
    • None
    • minimal
    • Java API
    • SE

      Summary

      If the model is not empty, the implementation of JList.getPreferredScrollableViewportSize() uses the height of the first cell multiplied by the visibleRowCount. The documentation for this method says fixedCellHeight would be used.

      Problem

      The documentation is incorrect: fixedCellHeight is not used.

      Solution

      Fix the documentation to align with the implementation and JCK.

      Specification

      Change API spec of JList.getPreferredScrollableViewportSize() from:

       * If the model isn't empty, the width is the preferred size's width,
       * typically the width of the widest list element. The height is the
       * {@code fixedCellHeight} multiplied by the {@code visibleRowCount},
       * plus the list's vertical insets.

      to:

       * If the model isn't empty, the width is the preferred size's width,
       * typically the width of the widest list element. The height is the
       * height of the cell with index 0 multiplied by the {@code visibleRowCount},
       * plus the list's vertical insets.

            aivanov Alexey Ivanov
            aivanov Alexey Ivanov
            Alan Bateman, Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: