Re: How to set number of collumns and rows in JTable after JTable object was created?
- From: "Bjorn Abelli" <bjorn_abelli@xxxxxxxxxxxxxxxxxxxxx>
- Date: 29 Apr 2006 01:44:37 +0200
"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
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.
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
Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
.
- References:
- Prev by Date: How to set number of collumns and rows in JTable after JTable object was created?
- Next by Date: PrepareStatement-Date field
- Previous by thread: How to set number of collumns and rows in JTable after JTable object was created?
- Next by thread: PrepareStatement-Date field
- Index(es):