Results 1 to 3 of 3
  1. #1
    doha786 is offline Member
    Join Date
    Mar 2009
    Posts
    48
    Rep Power
    0

    Arrow need help to append 2D array

    hi,
    in a GUI class i made JTable with three buttons.
    'show1' button showing the section1 values and 'show2' button revalidate the table and showing the section2 values..

    now i need to append section2 values after section1, once i click 'showAll' button.. this one i dont know how to do :(?
    pls help..
    Java Code:
    String[] column={"Name", "Age", "Sex"};
    String[][] section1={{"Calvin", "male", "23"}, {"Kathy","female","21"}};
    
    String[][] section2={{"Ravi","male","26"},{"Jesan","male","25"}};
    ..
    ..
    DefaultTableModel model=new DefaultTableModel(section1,column);//show when click 'show1'
    ..
    ..
    what we are thinking, it might not be true

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,763
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by doha786 View Post
    hi,
    in a GUI class i made JTable with three buttons.
    'show1' button showing the section1 values and 'show2' button revalidate the table and showing the section2 values..

    now i need to append section2 values after section1, once i click 'showAll' button.. this one i dont know how to do :(?
    pls help..
    Java Code:
    String[] column={"Name", "Age", "Sex"};
    String[][] section1={{"Calvin", "male", "23"}, {"Kathy","female","21"}};
    
    String[][] section2={{"Ravi","male","26"},{"Jesan","male","25"}};
    ..
    ..
    DefaultTableModel model=new DefaultTableModel(section1,column);//show when click 'show1'
    ..
    ..
    Know your core classes:

    Java Code:
    String[][] first= {{ "Pebbles", "Bambam" }};
    String[][] second= {{ "Fred", "Barney" }, { "Wilma", "Betty" }};
    String[][] copy= Arrays.copyOf(first, first.length+second.length);
    
    System.arraycopy(second, 0, copy, first.length, second.length);
    kind regards,

    Jos

  3. #3
    doha786 is offline Member
    Join Date
    Mar 2009
    Posts
    48
    Rep Power
    0

    Default

    thanks a lot..

    its working now.
    what we are thinking, it might not be true

Similar Threads

  1. How to Append in file ?
    By Hippo in forum New To Java
    Replies: 2
    Last Post: 03-19-2010, 02:50 PM
  2. Browse for and append
    By looselispssinkships in forum New To Java
    Replies: 0
    Last Post: 03-19-2010, 11:25 AM
  3. How can we append the stirng in excel using jxl
    By javasaravanan in forum Advanced Java
    Replies: 0
    Last Post: 11-26-2009, 10:01 AM
  4. JLabel append?
    By Jononomous in forum New To Java
    Replies: 0
    Last Post: 04-07-2008, 08:41 PM
  5. Simple append question
    By Rageagainst20 in forum New To Java
    Replies: 0
    Last Post: 12-21-2007, 12:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •