![]() |
![]() |
![]() |
![]() |
Creating a TableModel
So far, we've connected to a database, we've set up code to send an SQL query to the database, and we've stored the results. We now want to be able to display the data. To do this we will create a TableModel.
- From the Part List, select 'table' to view the properties of our JTable.
- Choose the TableModel tab. This code area contains the methods which describe the data we wish to place in the table.
- Choose 'getColumnCount' from the method choice field (above the code area).
- Enter the following code:
The TableModel code is executed on the fly in the same manner as the event code which you are already familiar with. As you enter each of the above pieces of code, the table will show the results.
Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |
![]() |
![]() |
![]() |
![]() |