KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > base > SortUserInChan


1 package zirc.base ;
2
3 import java.util.* ;
4
5 import zirc.gui.* ;
6
7 //zIrc, irc client.
8
// Copyright (C) 2004 CoolBytes(Stephane claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com
9
//
10
// This program is free software; you can redistribute it and/or
11
// modify it under the terms of the GNU General Public License
12
// as published by the Free Software Foundation; either version 2
13
// of the License, or (at your option) any later version.
14
//
15
// This program is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU General Public License for more details.
19

20 /**
21  * <p>Title: SortUserInChan</p>
22  * <p>Description: tri des users d'un chan</p>
23  * <p>Copyright: Copyright (c) 2004</p>
24  * <p>Company: CoolBytes(Stephane claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com</p>
25  * @version 1.0
26  */

27
28 public class SortUserInChan
29 {
30   private ChatFrame chatFrame ;
31
32   public SortUserInChan(ChatFrame _chatFrame)
33   {
34     chatFrame = _chatFrame ;
35   }
36
37   /**
38    * sort trie les users et met a jour le listmodel de la jlist de ChatFrame
39    *
40    * @param users ArrayList
41    */

42   public void sort(ArrayList users)
43   {
44     String JavaDoc[] tmp = new String JavaDoc[users.size()] ;
45
46     for (int i = 0 ; i < users.size() ; i++)
47     {
48       tmp[i] = users.get(i).toString() ;
49     }
50
51     Arrays.sort(tmp) ;
52
53     for (int i = 0 ; i < users.size() ; i++)
54     {
55       chatFrame.getListModel().add(i, tmp[i]) ;
56     }
57
58   }
59
60 }
61
Popular Tags