Results 1 to 5 of 5
  1. #1
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    441
    Rep Power
    6

    Default Add a row in JTable

    Hi,
    I have created the table with 4 colums and a single row.
    I have too three text box.
    When the user enter the Text in text box and click the add button .
    The data should be added in new row of the table..
    What should i do for that?

    Thanks for your help..
    Mak
    (Living @ Virtual World)

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    The key here, I think is to use the right table model. I'd recommend that you use a DefaultTableModel object as your table's model, and that you call its addRow(Vector v) method when you want to add data to the bottom of your JTable. It should update the GUI automatically.

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    441
    Rep Power
    6

    Default

    I could n't call method addrow from my table object..
    By which object,I can call this method?
    Mak
    (Living @ Virtual World)

  4. #4
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    441
    Rep Power
    6

    Default

    I was not able to understand it.
    Which language is it?
    Mak
    (Living @ Virtual World)

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    As I mentioned above, the key is the table model you use, not the table. You use a DefaultTableModel as your model, set the JTable's model to this object, and then add rows by calling addRow on the table model object. Please have a look at the DefaultTableModel API, and all of your questions will be answered.

Similar Threads

  1. Regarding the JTable
    By suresh.uvce in forum AWT / Swing
    Replies: 5
    Last Post: 02-11-2009, 06:46 AM
  2. Row Name In Jtable
    By SANDY_INDIA in forum AWT / Swing
    Replies: 1
    Last Post: 08-16-2008, 12:23 AM
  3. Regarding JTable
    By adeeb in forum AWT / Swing
    Replies: 12
    Last Post: 06-19-2008, 07:39 AM
  4. Regarding JTable
    By adeeb in forum SWT / JFace
    Replies: 0
    Last Post: 06-18-2008, 06:13 PM
  5. Replies: 2
    Last Post: 05-15-2008, 10:15 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
  •