javax.swing.table.TableModel.getColumnCount()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中javax.swing.table.TableModel.getColumnCount()方法的一些代码示例,展示了TableModel.getColumnCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableModel.getColumnCount()方法的具体详情如下:
包路径:javax.swing.table.TableModel
类名称:TableModel
方法名:getColumnCount

TableModel.getColumnCount介绍

暂无

代码示例

代码示例来源:origin: groovy/groovy-core

public int getColumnCount() {
  return (model == null) ? 0 : model.getColumnCount();
}

代码示例来源:origin: groovy/groovy-core

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;
}

代码示例来源:origin: groovy/groovy-core

/**
 * 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;
}

代码示例来源:origin: ron190/jsql-injection

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++) {

代码示例来源:origin: org.jspresso.framework/jspresso-swing-application

/**
 * {@inheritDoc}
 */
@Override
public int getColumnCount() {
 if (tableModel == null) {
  return 0;
 }
 return tableModel.getColumnCount();
}

代码示例来源:origin: net.sf.cuf/cuf-swing

/**
 * 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();
}

代码示例来源:origin: net.sf.sfac/sfac-core

/**
 * 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();
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime

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) + "]");
  }
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

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) + "]");
  }
}

代码示例来源:origin: stackoverflow.com

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;
     }
   }
 }
}

代码示例来源:origin: stackoverflow.com

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
      }
    }
  }
}

代码示例来源:origin: net.anwiba.commons/anwiba-commons-swing-core

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);
 }
}

代码示例来源:origin: org.activecomponents.jadex/jadex-commons-gui

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;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
@Override
public int getColumnCount() {
  return table.getModel().getColumnCount();
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc}
 */
@Override
public int getColumnCount() {
  return table.getModel().getColumnCount();
}

代码示例来源:origin: pentaho/pentaho-reporting

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 );
 }
}

代码示例来源:origin: stackoverflow.com

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);
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

public void clear() {
    super.clear();
    Collection<Object> items = Collections.emptyList();
    for( int column=0; column<getTable().getModel().getColumnCount(); column++) {
      execute(column, items);
    }
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * 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);
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * 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);
  }
}

相关文章