Hi, i have problem with JTable. I have to reuse JTable object after it
was previously created. I don't know how many rows it must contains at
the moment of creation, so I could not use default constructor
JTable(int col,int row). Is it possible to dynamically set size of the
jtable?
I need this jtable to present data from database querry. It each time
user clicks button "Show records" querry to database is made and
regarding how many rows it returns JTable object should be set to
proper number of rows.
Bjorn Abelli - 29 Apr 2006 00:44 GMT
"wierus" wrote...
> Hi, i have problem with JTable. I have to reuse JTable object after it
> was previously created. I don't know how many rows it must contains at
[quoted text clipped - 5 lines]
> regarding how many rows it returns JTable object should be set to
> proper number of rows.
This hasn't so much with databases to do, but more with GUI's...
Anyway, it's actually not the JTable itself that controls how many rows or
columns it contains, but the TableModel it has assigned to it.
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/table/TableModel.html
There's two main ways of dealing with changes in the numbers of rows and
colums i JTables.
- assign a new TableModel to the JTable
- manipulate the existing TableModel
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#data
// Bjorn A