public int getColumnCount() { return (model == null) ? 0 : model.getColumnCount(); }
public Object next() { int cols = self.getColumnCount(); Object[] rowData = new Object[cols]; for (int col = 0; col < cols; col++) { rowData[col] = self.getValueAt(row, col); } row++; return rowData; }
/** * Support the subscript operator for TableModel. * * @param self a TableModel * @param index the index of the row to get * @return the row at the given index * @since 1.6.4 */ public static Object[] getAt(TableModel self, int index) { int cols = self.getColumnCount(); Object[] rowData = new Object[cols]; for (int col = 0; col < cols; col++) { rowData[col] = self.getValueAt(index, col); } return rowData; }
TableModel model = table.getModel(); for (int i = 2 ; i < model.getColumnCount() ; i++) { excel.write(model.getColumnName(i) + "\t"); for (int j = 2 ; j < model.getColumnCount() ; j++) {
/** * {@inheritDoc} */ @Override public int getColumnCount() { if (tableModel == null) { return 0; } return tableModel.getColumnCount(); }
/** * Returns the number of columns in the model. A * <code>JTable</code> uses this method to determine how many columns it * should create and display by default. * * @return the number of columns in the model */ public int getColumnCount() { return (mModel == null) ? 0 : mModel.getColumnCount(); }
/** * Returns the number of columns in the model. A <code>JTable</code> uses this method to determine how many columns it should * create and display by default. * * @return the number of columns in the model * @see #getRowCount */ public int getColumnCount() { return chainedModel.getColumnCount(); }
public static void ensureColumnIndex(TableModel model, int index) throws ArrayIndexOutOfBoundsException { if (index < -1 || index >= model.getColumnCount()) { throw new ArrayIndexOutOfBoundsException( "the columnIndex was " + index + ", but should be int [0," + (model.getColumnCount() - 1) + "]"); } }
public static void ensureColumnIndex(TableModel model, int index) throws ArrayIndexOutOfBoundsException { if (index < -1 || index >= model.getColumnCount()) { throw new ArrayIndexOutOfBoundsException( "the columnIndex was " + index + ", but should be int [0," + (model.getColumnCount() - 1) + "]"); } }
int getRowByValue(TableModel model, Object value) { for (int i = model.getRowCount() - 1; i >= 0; --i) { for (int j = model.getColumnCount() - 1; j >= 0; --j) { if (model.getValueAt(i, j).equals(value)) { // what if value is not unique? return i; } } } }
public void submit(){ String recordvalues = ""; //contains a String representation of what I want to submit TableModel model = tableEntry.getModel(); for(int a = 0; a < model.getColumnCount();a++){ for(int b = 0; b < model.getRowCount();b++){ if(a != 0){ //I want to skip the first column recordvalues = recordvalues + (String) model.getValueAt(b, a) + ","; //The error is at this line in the code } } } }
public static void setTableCellRenderer( final JTable table, final TableModel tableModel, final TableCellRenderer cellRenderer) { final TableColumnModel columnModel = table.getColumnModel(); for (int i = 0; i < tableModel.getColumnCount(); i++) { final TableColumn column = columnModel.getColumn(i); column.setCellRenderer(cellRenderer); } }
private Vector getRowData(int row) { Vector rowData = new Vector(); int columns = delegate.getColumnCount(); for (int column = 0; column < columns; column++) { rowData.add(delegate.getValueAt(row, column)); } return rowData; }
/** * {@inheritDoc} */ @Override public int getColumnCount() { return table.getModel().getColumnCount(); }
/** * {@inheritDoc} */ @Override public int getColumnCount() { return table.getModel().getColumnCount(); }
public ReportDataRow( final TableModel reportData ) { if ( reportData == null ) { throw new NullPointerException(); } this.reportData = reportData; this.cursor = 0; final int columnCount = reportData.getColumnCount(); this.names = new String[columnCount]; for ( int i = 0; i < columnCount; i++ ) { this.names[i] = reportData.getColumnName( i ); } }
public void copyAll() { final TableModel tableAModel = tableA.getModel(); final DefaultTableModel copy = new DefaultTableModel(tableAModel.getRowCount(), 0); for (int column = 0; column < tableAModel.getColumnCount(); column++) { copy.addColumn(tableAModel.getColumnName(column)); for (int row = 0; row < tableAModel.getRowCount(); row++) copy.setValueAt(tableAModel.getValueAt(row, column), row, column); } tableB.setModel(copy); }
public void clear() { super.clear(); Collection<Object> items = Collections.emptyList(); for( int column=0; column<getTable().getModel().getColumnCount(); column++) { execute(column, items); } } }
/** * Updates per-column class in StringValueRegistry. This is called after * structureChanged. */ private void updateStringValueRegistryColumnClasses() { getStringValueRegistry().setColumnClasses(null); for (int i = 0; i < getModel().getColumnCount(); i++) { getStringValueRegistry().setColumnClass(getModel().getColumnClass(i), i); } }
/** * Updates per-column class in StringValueRegistry. This is called after * structureChanged. */ private void updateStringValueRegistryColumnClasses() { getStringValueRegistry().setColumnClasses(null); for (int i = 0; i < getModel().getColumnCount(); i++) { getStringValueRegistry().setColumnClass(getModel().getColumnClass(i), i); } }