TableModel
editor might be useful.![]() |
Number of rows: 1 to 99. |
![]() |
Number of columns: 1 to 16. (Both the column-definition table and the data table have context menus allowing you to insert or remove columns.) |
![]() |
Title: Enter the column title. |
![]() |
Type: Select between Object , Boolean and Icon . (You can easily simulate the Number type with a right-aligned cell renderer and, maybe, a monospaced font) |
![]() |
Default value: Enter the default value for this column. |
![]() |
Editable: Select, if this column's data shall be editable or not. |
![]() |
Resizable: Select, if this column is resizable or not (non-resizable columns will be displayed at their preferred size and will not stretch). Enabled only with a table type of SelfResizingTable . |
![]() |
Column renderer: Define a TableCellRenderer for this column. |
![]() |
Header renderer: Define a for the header of this column. |
![]() |
Table data: Enter the data. If you right-click a table cell, you can define a cell renderer for this individual cell. (Note: Cell renderers for individual cells will only be remembered, if you select the SelfResizingTable type.) |
![]() |
Table type: You can choose between JTable and SelfResizingTable. SelfResizingTable is special in that it calculates the optimal column widths every time its tableChanged(TableModelEvent) method is called or its parent container is resized. (Please see the note below about performance issues) |
![]() |
Default Model: Set the default "A" | "B" | "C" 6 x 3 model and discard any custom cell renderers. |
Note: SelfResizingTable isn't for free. It costs time to calculate column widths because every table cell is inspected for its preferred width. I used SelfResizingTable with table models containing up to 100,000 rows and found performance acceptable.If you feed a SelfResizingTable with a table model of your own, you need to know that every TableModel method starting with fire finally will call tableChanged(TableModelEvent) and so trigger recalculation of column widths.
A SelfResizingTable will appear as type JTable in the exported class. This makes sense because it has no additional methods.Further note, that autoResizeMode has no effect on SelfResizingTable .
|
RadiTableModel
which is derived from
DefaultTableModel
.
|
|