1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| DefaultTableModel dtm= new DefaultTableModel();
dtm.setColumnIdentifiers(idColonnes);
TableSorter ts= new TableSorter(dtm);
Vector<Object> vo;
Symbole s;
DecimalFormat df= new DecimalFormat("0.#####");
while(e.hasNext())
{
s= (Symbole) f.next();
vo= new Vector<Object>();
vo.add("'" + e.next() +"'");
vo.add(s.getFreq());
vo.add(df.format(s.getProba()));
vo.add(s.getCode());
dtm.addRow(vo);
}
ts.setColumnComparator(Integer.class, new Comparator<Integer>() {
public int compare(Integer a, Integer b)
{
return new Integer(a - b);
}
}); |