public String getColumnName(int columnIndex) { String answer = null; if (columnIndex < 0 || columnIndex >= columnModel.getColumnCount()) { return answer; } Object value = columnModel.getColumn(columnIndex).getHeaderValue(); if (value != null) { return value.toString(); } return answer; }
public void setValueAt(Object value, int rowIndex, int columnIndex) { List rows = getRows(); if (rowIndex < 0 || rowIndex >= rows.size()) { return; } if (columnIndex < 0 || columnIndex >= columnModel.getColumnCount()) { return; } Object row = getRows().get(rowIndex); rowModel.setValue(row); DefaultTableColumn column = (DefaultTableColumn) columnModel.getColumn(columnIndex); if (row == null || column == null) { return; } column.setValue(row, value, rowIndex, columnIndex); }
public Object getValueAt(int rowIndex, int columnIndex) { List rows = getRows(); Object answer = null; if (rowIndex < 0 || rowIndex >= rows.size()) { return answer; } if (columnIndex < 0 || columnIndex >= columnModel.getColumnCount()) { return answer; } Object row = getRows().get(rowIndex); rowModel.setValue(row); DefaultTableColumn column = (DefaultTableColumn) columnModel.getColumn(columnIndex); if (row == null || column == null) { return answer; } return column.getValue(row, rowIndex, columnIndex); }
/** Removes a column definition from the table */ public void removeColumn(DefaultTableColumn column) { columnModel.removeColumn(column); }
/** Adds a new column definition to the table */ public void addColumn(DefaultTableColumn column) { column.setModelIndex(columnModel.getColumnCount()); columnModel.addColumn(column); }
/** @return the column definitions. */ public List getColumnList() { return columnModel.getColumnList(); }
protected ValueModel getColumnModel(int columnIndex) { DefaultTableColumn column = (DefaultTableColumn) columnModel.getColumn(columnIndex); return column.getValueModel(); }
public int getColumnCount() { return columnModel.getColumnCount(); }