ListCellRenderer render = l.getCellRenderer();  System.out.println("RENDER-JLIST: " + rows + ", " + l.getModel().getSize());  paintBackground(g, c);  if (l.getModel().getSize() == 0) return;   Component elt = render.getListCellRendererComponent(l, l.getModel().getElementAt(0), 0, false, false); Dimension dim = elt.getPreferredSize();  Rectangle a = new Rectangle(0, 0, dim.width, dim.height);  for (int i=0;i<l.getModel().getSize();i++) { boolean is_sel = false; boolean has_focus = false;  Component comp = render.getListCellRendererComponent(l, l.getModel().getElementAt(i), i, is_sel, has_focus);    comp.setBounds(a);  comp.paint(g);  a.y += dim.height + gap_between_cells; } }
for (int row = 0; row < nrows; ++row) { Rectangle bounds = getCellBounds(list, row, row); paintCell(g, row, bounds, render, model, sel, lead); } }
    public void paint(Graphics g, 		      JComponent c)    {      	JList l = (JList) c;	int rows = l.getVisibleRowCount();	ListCellRenderer render = l.getCellRenderer();	System.out.println("RENDER-JLIST: " + rows + ", " + l.getModel().getSize());	paintBackground(g, c);	if (l.getModel().getSize() == 0)	    return;	// use element 0 to figure out how big we are:	Component elt = render.getListCellRendererComponent(l,							    l.getModel().getElementAt(0),							    0,       							    false,							    false);	Dimension dim = elt.getPreferredSize();		Rectangle a = new Rectangle(0,				    0,				    dim.width,				    dim.height);	for (int i=0;i<l.getModel().getSize();i++)	    {		boolean is_sel = false;		boolean has_focus = false;		Component comp = render.getListCellRendererComponent(l,								     l.getModel().getElementAt(i),								     i,            								     is_sel,								     has_focus);		//System.out.println("AAAAA=> " + a + ", " + comp + ", index = " + i);		comp.setBounds(a);		comp.paint(g);		a.y += dim.height + gap_between_cells;	    }    }