The JTable Class
Well, we made it this far without
officially discussing the JTable class itself.
Dynamic data and database queries are all handled entirely by the
table model underneath the display. So what can you do with a
JTable object? The JTable class
gives you control over the appearance and behavior of the table. You
can control the spacing of columns, their resizability, their colors,
and so on. The JTable object will be the source of
row selections, and through delegation, you can add and remove rows
and columns directly with the JTable object.
Properties
The appearance of a JTable is manipulated almost
entirely through its properties. To make things a bit more
manageable, we’ll break the properties up into three smaller
tables: one for row, column and cell properties; one for selection
properties; and one for the visual properties. Table 15.9 covers the row, column, and cell properties.
Table 15-9. JTable Row, Column, and Cell Properties
|
Property |
Data Type |
get |
is |
set |
bound |
Default Value |
|---|---|---|---|---|---|---|
|
|
|
• |
• |
| ||
|
|
|
• |
• |
| ||
|
|
|
• |
• |
| ||
|
|
|
• |
• |
| ||
|
|
|
• |
| |||
|
|
|
• |
| |||
|
|
|
• |
• |
|
The
autoCreateColumnsFromModel
property determines whether or not the column model ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access