**hi guy recently i created one AbstracttableModel and one class named Veiculo, and i created a vector to hold Veiculo's data, i copied veiculo's data to text file named "UniVeiculo.txt", now i want read and show some data from UniVeiculo.txt to AbstractTableModel.
i tryed use this code:

 String cod="",mark="",year="",color="",model="",plate="",owner="",

 List<Veiculo> carro = new ArrayList<Veiculo>();
Veiculo car = new Veiculo();
try{BufferedReader br = new BufferedReader(new FileReader(new File("UniVeiculo.txt")));
 cod=br.readLine();

 while(cod!=null){

car.Marca=mark;
car.Modelo=model;
car.Placa=plate;
car.Dono=owner;
car.Resid=adress;

carro.add(car);



JTable tabela = new JTable(new ModeloTabela(carro));

cod=br.readLine();
mark=br.readLine(); year=br.readLine();color=br.readLine(); model=br.readLine();plate=br.readLine(); owner=br.readLine();
 adress=br.readLine(); type=br.readLine(); gbox=br.readLine(); seats=br.readLine(); displacement=br.readLine(); country=br.readLine(); space=br.readLine();

 }br.close();

   }catch(IOException evt){JOptionPane.showMessageDialog(null,"  Error   ");}
   return carro;
   }

help me.**

Edited 2 Years Ago by TonSingle: i wanted to give more details

hate to tell you, but even the first line of the code you posted wouldn't compile. you need to end it with a ';', not a ','.

also, this:
}catch(IOException evt){JOptionPane.showMessageDialog(null," Error ");}
even though not the worst, not far from it. Ok, you know an exception got thrown. but you don't know why. at least add the message to your dialog:
}catch(IOException evt){JOptionPane.showMessageDialog(null," Error " + evt.getMessage());}

what exactly is it you need help with?

i need help to show some data into AbstractTableModel from text file. I added message to my Dialog, the system says that "cannot find the specified file"

I'm doubt that question in this form is answerable, you have to provide more effort than that

This article has been dead for over six months. Start a new discussion instead.