1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
public class DocumentModel extends AbstractTableModel {
private java.sql.Statement stmt;
private int colnum=3;
private int rownum;
private String[] colNames={
"اNom du fichier","Commentaires","code dossier"
};
private ArrayList<String[]> ResultSets;
public DocumentModel(ResultSet rs) {
ResultSets=new ArrayList<String[]>();
try{
while(rs.next()){
String[] row={
rs.getString("CODEDOSSIER"), rs.getString("COMMENTAIRES"),rs.getString("NOMFICHIER")
};
ResultSets.add(row);
}
}
catch(Exception e){
System.out.println("Exception in DocumentModel");
}
}
public Object getValueAt(int rowindex, int columnindex) {
String[] row=ResultSets.get(rowindex);
return row[columnindex];
}
public int getRowCount() {
return ResultSets.size();
}
public int getColumnCount() {
return colnum;
}
public String getColumnName(int param) {
return colNames[param];
}
public void removeNewRow(int row)
{
fireTableDataChanged();
}
public void clearDownload(int row) {
ResultSets.remove(row);
fireTableRowsDeleted(row, row);
}
} |
Partager