Here is a item tablelist.Its a JCombobox.I wrote the itemlistener for it.
The problem is when ever i select an item in it for the second time onwards i am unable to see the data in the listScroller in UI,but i can see the data in the console.
Ewerything is perfect lst is getting the data ,listScroller is also getting the data when i debugg and inspect i came to know that.
tablelist.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie)
{
if(ie.getSource()==tablelist){
if(ie.getStateChange()==ItemEvent.SELECTED)
{
JComboBox cb = (JComboBox)ie.getSource();
String st1 = (String)cb.getSelectedItem();
details=dbob.getDetails((String)list.getSelectedItem(), st1);
somearray = details.toArray(somearray);
((DefaultListModel) lst.getModel()).clear();
for(int i=0;i<somearray.length;i++)
{
((DefaultListModel) lst.getModel()).addElement(somearray[i]);
}
lst.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
lst.setLayoutOrientation(JList.VERTICAL);
lst.setVisibleRowCount(-1);
//listScroller.add(lst);
listScroller = new JScrollPane(lst);
listScroller.setPreferredSize(new Dimension(250, 80));
addComponent(p,source,0,1,1, 1, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL,-1,-1);
addComponent(p,listScroller,0,2,1, 1, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL,-1,-1);
lst is simply getting cleaned in UI.Please help me in this issue.