Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JTable Edit to .csv

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JTable Edit to .csv

    320925_10151369868529686_533488855_n.jpgI using forecast program by .csv

    try {
    String datafile = pathName;
    FileReader fin = new FileReader(datafile);
    DefaultTableModel m = createTableModel(fin,
    new Vector<Object>(Arrays.asList(
    new String[] { "a", "b", "c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"})));
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    table = new JTable(m);
    f.getContentPane().add(new JScrollPane(table));
    f.setSize(200, 300);
    f.setVisible(true);
    } catch (Exception e) {
    e.printStackTrace();
    }
     
     
    int row = table.getRowCount();
    int col = table.getColumnCount();
     
    for(int i=0;i<row;i++){
     
    for(int j=0;j<col;j++){
    System.out.println(table.getValueAt(j, i));
     
    } 
     
    }

    I need a code for reed file .csv ,edit value in cell on Jtable and export to .csv


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,661
    Thanks
    45
    Thanked 1,960 Times in 1,934 Posts

    Default Re: JTable Edit to .csv

    Please edit the code and properly format it. Not all statements should start in the first column.


    Also posted at http://www.java-forums.org/advanced-...-edit-csv.html
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. JTable edit cell when focus is gained
    By TheQuickBrownFox in forum AWT / Java Swing
    Replies: 0
    Last Post: December 7th, 2012, 08:24 PM
  2. I find code Editor CSV file with jtable
    By mazaoa in forum AWT / Java Swing
    Replies: 1
    Last Post: November 27th, 2012, 07:27 PM
  3. I find code Editor CSV file with jtable
    By mazaoa in forum AWT / Java Swing
    Replies: 1
    Last Post: November 27th, 2012, 07:25 PM
  4. Trying to read a CSV file !
    By Cruz182 in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: June 2nd, 2011, 01:30 PM
  5. Need help outputting the array to a .csv
    By arpanetguru in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: November 23rd, 2010, 04:27 PM

Tags for this Thread