Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. try{
  2. BufferedReader br = new BufferedReader(new FileReader("data.csv"));
  3. String riadok, one, two, three, four;
  4. // int pocet=0;
  5.  
  6. do{
  7. riadok = br.readLine();
  8. if(riadok !=null){
  9.  
  10. int poz = riadok.indexOf(";");
  11. one = riadok.substring(0, poz);
  12. // tabData.setValueAt(riadok.substring(0, poz), pocet, 0);
  13. riadok = riadok.substring(poz+1); poz = riadok.indexOf(";");
  14. two = riadok.substring(0, poz);
  15. //tabData.setValueAt(riadok.substring(0, poz), pocet, 1);
  16. riadok = riadok.substring(poz+1); poz = riadok.indexOf(";");
  17. three = riadok.substring(0, poz);
  18. // tabData.setValueAt(riadok.substring(0, poz), pocet, 2);
  19. riadok = riadok.substring(poz+1); poz = riadok.indexOf(";");
  20. four = riadok.substring(0, poz);
  21. // tabData.setValueAt(riadok.substring(0, poz), pocet, 3);
  22. // pocet++;
  23. Object[] row = {one, two, three, four};
  24. tabData.addRow(row);
  25. }
  26. }while(riadok != null);
  27. br.close();
  28.  
  29.  
  30. }catch (IOException e){
  31. JOptionPane.showMessageDialog(this, e.getMessage());
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement