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); }
/** Adds a new column definition to the table */ public void addColumn(DefaultTableColumn column) { column.setModelIndex(columnModel.getColumnCount()); columnModel.addColumn(column); }
public int getColumnCount() { return columnModel.getColumnCount(); }