Problem with CellRenderer in JList ..

Hello !

I'm trying to add JTextArea Component to JList but it don't work fine .

When I run my application , I don't see my JList .( I see empty panel )

Hire is my code:

class ListModelextends JLabelimplements ListCellRenderer

{

public ListModel()

{

//...

}

public Component getListCellRendererComponent( JList list , Object value ,int index,boolean is_selected,boolean cellHasFocus)

{

if(value!=null)

{

user = (Answer) value;

String ans = user.getAnswer() +" " + user.getData();//

JTextArea ar =new JTextArea(5,20);

ar.append(" ans + "\n");

add( ar);

}

}

returnthis;

}

//

private Answer user;//

private Font font;

}

[1723 byte] By [scotty_firea] at [2007-11-26 15:49:50]
# 1
You don't return the instance of JTextArea in case value != null.
quittea at 2007-7-8 22:09:30 > top of Java-index,Java Essentials,Java Programming...