JList within JScrollPane returns unexpected preferred size

XMLWordPrintable

      The problem is in the javax.swing.JList#getPreferredScrollableViewportSize method:

                 ...
                 Rectangle r = getCellBounds(0, 0);
                 if (r != null) {
                     height = (visibleRowCount * r.height) + dy;
                 }
                 ...
                 return new Dimension(width, height);

      Note that the size is calculated from the height of the first list item, which is incorrect. This causes items in popups with lists, having no fixed size, to have extra/unwanted space.

            Assignee:
            Alexey Ivanov
            Reporter:
            Shadow Bug
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: