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
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
>
>
>