Does anyone know how to move from a csv file to a jtable? At the moment but list everything in the first column.
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
try {
File file = new File("Users.csv");
if (!file.exists()) {
file.createNewFile();
}
FileReader fr = new FileReader(file.getAbsoluteFile());
BufferedReader br = new BufferedReader(fr);
String line;
while ((line = br.readLine()) != null) {
model.addRow(new String[] {line});
}
br.close();
fr.close();
}catch(Exception ex){
ex.printStackTrace();
}
}