DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    barnaboss Guest

    URGENT :: JTable - to add row


    Hi there,
    Can you please help me to add row dynamically to the existing table.
    I have created a table using the constructor JTable(Object[][],Object[])
    the problem is, here we have to give all the row values while creating the
    table. now i want to add a row.how to do it?
    If possible plz send me the code or suggest me some other way to create a
    table so that i can add rows dynamically.
    This is very urgent , so plz send me ur answer immediatly

    send ur answer to : barnaboss@yahoo.com
    thank you




  2. #2
    Paul Clapham Guest

    Re: URGENT :: JTable - to add row

    Short answer: Don't do that.

    If you have a JTable where you expect to change the number of rows, don't
    define it as a two-dimensional array, because you can't change an array's
    size. You can copy it into a new array of a different size, but then you're
    going to be back asking how to delete a row from the middle of the table.

    Instead, you could use the constructor where you provide your data as a
    Vector of Vectors. But if you're going to have a JTable whose contents
    change, you really need to have a TableModel that controls the data. Have a
    look at
    http://java.sun.com/docs/books/tutor...nts/table.html for a
    tutorial about how to work with JTables.

    PC2

    barnaboss <barnaboss@yahoo.com> wrote in message
    news:3ab0bf66$1@news.devx.com...
    >
    > Hi there,
    > Can you please help me to add row dynamically to the existing table.
    > I have created a table using the constructor JTable(Object[][],Object[])
    > the problem is, here we have to give all the row values while creating the
    > table. now i want to add a row.how to do it?
    > If possible plz send me the code or suggest me some other way to create a
    > table so that i can add rows dynamically.
    > This is very urgent , so plz send me ur answer immediatly
    >
    > send ur answer to : barnaboss@yahoo.com
    > thank you
    >
    >
    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links