How to display loop jxTaskpane for expand and collapse roster list

Hello everybody !

i have problem to display Taskpane for loop. i have a code to get the groups of roster (Groups : Friends - Business - Company, so on)

my code is :

Roster rost = xmppcon.getRoster();

Collection groups = rost.getGroups();

for(RosterGroup group : groups){

DefaultListModel model = new DefaultListModel();

model.addElement(group.getEntries());

String GroupNameCount = group.getName() + “(”+group.getEntryCount()+")";

jXTaskPane1.setTitle(GroupNameCount);

jXList1.setModel(model);

}

for(RosterGroup group : groups){

DefaultListModel model = new DefaultListModel();

model.addElement(group.getEntries());

String GroupNameCount = group.getName() + “(”+group.getEntryCount()+")";

jXTaskPane1.setTitle(GroupNameCount);

jXList1.setModel(model);

}

but jxTaskpane not loop, but when i print group name it print 2 line (because in database user A have two group is Friends and NIIT)

sample print

System.out.println(group.getName());

it will result:

Friends

NIIT