Normally i get the Data from my Tablemodel
table.setModel(new DefaultTableModel(
new Object[][] {
{"xxx", new Integer(10)},
{"xx", new Integer(40)},
{"x", new Integer(20)},
{"xxxxxx", new Integer(50)},
{"xxxxx", new Integer(30)},
},
new String[] {
"name", "tel"
}
But now i would get the Data from the "name" and "tel" from other Methods. The first method returns a String, who i would put in the "name". The second method returns a Integer, who i would put in the "tel". Then i would sort it, that the lowest integer is the first. Any name has his own telephonenumber.
My method Sorter:
public void sort()
{
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>();
table.setRowSorter( sorter );
sorter.setModel( model );
}
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {}
But it doesn't sort, i don't know what i should do.