importar datos de un txt a jtable
Acá te mando un ejemplo!!
//Leo archivo Text
private void FileTextRead() throws IOException {
int i = 0;
FileReader myFile = null;
try {
//Leo un Archivo de Texto
String file = "../FPInstruments/miArchivo.txt";
myFile = new FileReader(file);
BufferedReader InputFile = new BufferedReader(myFile);
// Read the first line
String currentRecord = InputFile.readLine();
while(currentRecord != null) {
currentRecord = InputFile.readLine();
try {
//Copio un valor a la celda
jTable1.setValueAt(currentRecord, 0, i);
//Refresco la Tabla
jTable1.paintImmediately(jTable1.getX(),jTable1.getY(), jTable1.getWidth(), jTable1.getHeight());
i = i +1;
}
catch (Exception ex) {
}
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Alarms.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
myFile.close();
} catch (IOException ex) {
Logger.getLogger(Alarms.class.getName()).log(Level.SEVERE, null, ex);
}
}
}