15.4. JTable

A JTable provides a way to display rows and columns of data in a two-dimensional display. It is by far the most complex component available in the Swing API. A JTable is actually based upon three separate models: a table model, a column model, and a list selection model. The table model maintains the data in the table cells, the column model controls addition and removal of columns in the table, and the list selection model is responsible for the selection of rows in the table (selection of columns is controlled by the column model).

Because of the complexity of a JTable, each of the three table models has a default implementation in the javax.swing.table package. In this section, we examine the default and custom table models. For ...

Get Core Web Programming, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.