public class JExporter { public void exporter(JTable table, File file) { try { TableModel model = table.getModel(); FileWriter out = new FileWriter(file); for(int i=0; i < model.getColumnCount(); i++) { out.write(model.getColumnName(i) +"\t"); } out.write("\n"); for(int i=0; i< model.getRowCount(); i++) { for(int j=0; j<model.getColumnCount(); j++) { Object value=model.getValueAt(i,j); if ( value!=null ){ out.write(model.getValueAt(i,j).toString()+"\t"); } } out.write("\n"); } out.close(); } catch(Exception err){ err.printStackTrace(); } } }