2

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
javanna
  • 59,145
  • 14
  • 144
  • 125
MYE
  • 983
  • 8
  • 24
  • 41

1 Answers1

1

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.

Guillaume
  • 14,306
  • 3
  • 43
  • 40
  • i know it, it try before ask question but not work my code `JXTaskPane taskpane = new JXTaskPane(); getContentPane().add(taskpane); taskpane.setBounds(60, 60, 60, 60);` it just display lasted group – MYE Jan 09 '11 at 17:23
  • JXTaskPane are supposed to be added into a JXTaskPaneContainer, not in a JFrame's content pane. – Guillaume Jan 11 '11 at 06:55