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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.