/[classpath]/classpath/javax/swing/JList.java
ViewVC logotype

Diff of /classpath/javax/swing/JList.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by mark, Sat Jun 26 16:07:01 2004 UTC revision 1.16 by mark, Thu Jul 22 19:45:39 2004 UTC
# Line 994  public class JList extends JComponent im Line 994  public class JList extends JComponent im
994     */     */
995    public Dimension getPreferredScrollableViewportSize()    public Dimension getPreferredScrollableViewportSize()
996    {    {
997      return getPreferredSize();      int vis = getVisibleRowCount();
998        int nrows = getModel() == null ? 0 : getModel().getSize();
999        // FIXME: this is a somewhat arbitrary default, but.. ?
1000        Dimension single = new Dimension(10, 10);;
1001        Rectangle bounds = null;
1002    
1003        if (vis > nrows)
1004          {
1005            if (fixedCellWidth != -1 &&
1006                fixedCellHeight != -1)
1007              {
1008                single = new Dimension(fixedCellWidth, fixedCellHeight);
1009              }
1010            else if (nrows != 0 && getUI() != null)
1011              {
1012                Rectangle tmp = getUI().getCellBounds(this, 0, 0);
1013                if (tmp != null)
1014                  single = tmp.getSize();
1015              }
1016          }
1017        else if (getUI() != null)
1018          {
1019            return getUI().getCellBounds(this, 0, vis - 1).getSize();
1020          }
1021    
1022        return new Dimension(single.width, single.height * vis);
1023    }    }
1024    
1025    /**    /**

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26