Smack API - How to display loop jxTaskpane for expand and collapse roster list

StackOverflow https://stackoverflow.com/questions/4637621

  •  08-10-2019
  •  | 
  •  

سؤال

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<RosterGroup> 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);

        }

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());

result:

Friends




NIIT
هل كانت مفيدة؟

المحلول

You're using the same instances of JXTaskPane and JXList at each iteration of the loop. You should really create one instance (JXTaskPane jXTaskPane1 = new JXTaskPane()), and same for the JXList in the loop.

When you've setup the JXTaskPane, add it to the containing component.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top