public Dimension getPreferredSize(JComponent c) { JList l = (JList) c;  System.out.println("XXXXXXXXXXXXXXXxx   getPreferredSize------------> " + l);   int rows = l.getVisibleRowCount();  ListCellRenderer render = l.getCellRenderer();  int width  = 200; int height = rows * 16;  if (l.getModel().getSize() == 0) { return new Dimension(width, height); }  System.out.println("BASIC_LIST_UI ====-> " + l.getModel().getElementAt(0));  Component elt = render.getListCellRendererComponent(l, l.getModel().getElementAt(0), 0, false, false); Dimension a = elt.getPreferredSize(); if (a == null) { return new Dimension(width, height); }  return new Dimension(a.width, a.height * rows); }
public Dimension getPreferredSize(JComponent c) { maybeUpdateLayoutState(); if (list.getModel().getSize() == 0) return new Dimension(0, 0); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); return bounds.getSize(); }
    public Dimension getPreferredSize(JComponent c)     {	JList l = (JList) c;	System.out.println("XXXXXXXXXXXXXXXxx   getPreferredSize------------> " + l);		int rows = l.getVisibleRowCount();	ListCellRenderer render = l.getCellRenderer();		int width  = 200;	int height = rows * 16; 		if (l.getModel().getSize() == 0)	    {		return new Dimension(width, height);	    }	System.out.println("BASIC_LIST_UI ====-> " + l.getModel().getElementAt(0));	Component elt = render.getListCellRendererComponent(l,							    l.getModel().getElementAt(0),							    0,            							    false,							    false);	Dimension a = elt.getPreferredSize();	if (a == null)	    {		return new Dimension(width, height);	    }	return new Dimension(a.width,			     a.height * rows);    }