Tuesday, April 1, 2008

JTableDemo : How to add rows to JTable, How to create a JTable by specifying Table Headers and Row Values.

The basic use of JTable is presenting Table, i.e, rows of column centric data to the user.
Here is a program that uses JTable to present such a sample data. Also provision for adding data/rows randomly.
The major Swing API's used for this pupose are
1) javax.swing.JTable
2) javax.swing.table.DefaultTableModel

There are more uses for this swing API, other than just presnting data.

Click Here to view the code

The figure is screenshot when the code mentioned here executes

No comments: