With a JakartaWrapper you can do it like this:
FTPFile[] children = wrapper.listFiles();
FileTableModel1 model1 = new FileTableModel1(children);
table1 = new JTable(model1);
and than the code for filetablemodel1:
class FileTableModel1 extends AbstractTableModel{
private FTPFile[] data;
private String[] columnNames = {"", "name", "size"};
private Class[] columnClasses = {Icon.class, String.class,Long.class};
public FileTableModel1(FTPFile[] data) {
this.data = data;
}
public int getColumnCount() {
return columnNames.length;
}
public int getRowCount() {
return data.length;
}
public String getColumnName(int col) {
return columnNames[col];
}
public Class getColumnClass(int col) { return columnClasses[col]; }
public Object getValueAt(int row, int col) {
FTPFile file = data[row];
switch( col ){
case 0: return file.isDirectory() ? folder : files;
case 1: return file.getName();
case 2: if (file.getSize()==1024 || file.getSize()==2048 || file.getSize()==3072){
return null;
}else{
return file.getSize();
}
default:
return new Object();
}
}
}
Satanduvel