workhorse methods of JTable + TableModel + TableColumnModel

Sooner or later you need to internalize these –

———–JT
set/getValueAt() — in both JT/TM, but different behavior

–editor/renderer
TableCellRenderer getCellRenderer(int row, int column)
int getEditingColumn/Row(void) — If nothing is being edited, returns -1
Component getEditorComponent(void) — If nothing is being edited, returns null

–related to table columns
getColumnCount() — JT/TCM identical, covering the View columns
TableColumnModel getColumnModel() — don’t use the createDefaultTableModel()

—less important ones
int getSelectedColumn/Row(void) Returns the index of the first selected column/row, -1 if no column is selected.
int[] getSelectedColumns/Rows() Returns the indices of all selected columns/rows.
convert[Column|Row]IndexToModel (int viewIndex)
convert[Column|Row]IndexToView (int modelIndex)

———–TM
getColumnCount() — different from the JT version. Covers the Model columns
set/getValueAt() — in both JT/TM, but different behavior
boolean isCellEditable(int, int)
addTableModelListener()

———–TCM
getColumn(int columnIndex)
getColumnCount() – JT/TCM identical
getColumnIndex(Object columnIdentifier)
removeColumn(TableColumn aColumn) — JT/TCM identical
moveColumn(int column, int targetColumn) — JT/TCM identical
addColumn(TableColumn aColumn) — JT/TCM similar

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s