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

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

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

TableModel.getColumnName介绍

暂无

代码示例

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

public String getColumnName(int aColumn) {
  return model.getColumnName(aColumn);
}

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

excel.write(model.getColumnName(i) + "\t");

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

/**
 * Returns the name of the column at <code>aColumn</code>.  This is used
 * to initialize the table's column header name.  Note: this name does
 * not need to be unique; two columns in a table can have the same name.
 *
 * @param    pColumn    the index of the column
 * @return  the name of the column
 */
public String getColumnName(final int pColumn)
{
  return mModel.getColumnName(pColumn);
}

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

/**
 * {@inheritDoc}
 */
@Override
public String getColumnName(int column) {
 return tableModel.getColumnName(column);
}

代码示例来源:origin: in.jlibs/org-netbeans-swing-outline

public String getColumnName(int columnIndex) {
  if (columnIndex == 0) {
    return nodesColumnLabel;
  } else {
    return tableModel.getColumnName(columnIndex-1);
  }
}

代码示例来源:origin: xyz.cofe/gui.swing

@Override
public String getColumnName(int columnIndex) {
  if( tableModel==null )return "?";
  int c = mapColumnToInside(columnIndex);
  if( c<0 )return "?";
  return tableModel.getColumnName(c);
}

代码示例来源:origin: com.nelkinda.japi/nelkinda-japi-swing

public static String[] getColumnNames(@NotNull final JTable jTable) {
  final TableModel tableModel = jTable.getModel();
  final int columnCount = tableModel.getColumnCount();
  final String[] columnTitles = new String[columnCount];
  for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) {
    columnTitles[columnIndex] = tableModel.getColumnName(columnIndex);
  }
  return columnTitles;
}

代码示例来源:origin: nroduit/Weasis

public static String[] getColumnNames(TableModel model) {
  if (model == null) {
    return new String[0];
  }
  String[] names = new String[model.getColumnCount()];
  for (int i = 0; i < names.length; i++) {
    names[i] = model.getColumnName(i);
  }
  return names;
}

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

private HashMap<String, Integer> createColumnNameIndex() {
 HashMap<String, Integer> idx = new HashMap<String, Integer>();
 TableModel tableModel = getModel();
 int cc = tableModel.getColumnCount();
 for ( int i = 0; i < cc; i += 1 ) {
  idx.put( tableModel.getColumnName( i ), i );
 }
 return idx;
}

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

public String getColumnName( final int columnIndex ) {
 if ( columnIndex < 0 ) {
  throw new IndexOutOfBoundsException();
 }
 if ( columnIndex < backend.getColumnCount() ) {
  return backend.getColumnName( columnIndex );
 }
 return ClassicEngineBoot.INDEX_COLUMN_PREFIX + indexToColumn( columnIndex );
}

代码示例来源: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.fudaa.framework.ebli/ebli-common

public String getColumnName(final int _col) {
 String r = "" + (char) ('A' + _col);
 if (_col < table_.getColumnCount()) {
  r = table_.getColumnName(_col) + " [" + r + "]";
 } else {
  r = " (" + formules_.get(_col - table_.getColumnCount()) + ") " + "[" + r + "]";
 }
 return r;
}

代码示例来源:origin: net.sourceforge.cpdetector/cpdetector

protected final void renderHeader(TableModel model) throws IOException{
 int cols = model.getColumnCount();
 for(int i=0;i<cols;i++){
  this.renderHeaderCell(model.getColumnName(i),(i==0)?FIRST_CELL_IN_ROW:(i==cols-1)?LAST_CELL_IN_ROW:2);
 }
}

代码示例来源:origin: senbox-org/snap-desktop

private void encodeHeadline(CsvWriter csv) throws IOException {
  int count = model.getColumnCount();
  final String[] colNames = new String[count];
  for (int col = 0; col < count; col++) {
    colNames[col] = model.getColumnName(col);
  }
  csv.writeRecord(colNames);
}

代码示例来源:origin: jawi/ols

/**
 * Resets the column header to the value from the contained {@link TableModel}
 * .
 * 
 * @param aColumnIndex
 *          the index of the column to reset the header value for.
 */
public void resetColumnHeader( int aColumnIndex )
{
 setColumnHeader( aColumnIndex, getModel().getColumnName( aColumnIndex ) );
}

代码示例来源:origin: dom4j/dom4j

protected void assertColumnNameEquals(TableModel tableModel,
    int columnIndex, String name) {
  assertEquals("Column name correct for index: " + columnIndex, name,
      tableModel.getColumnName(columnIndex));
}

代码示例来源:origin: abbot/abbot

/** Find the first String match in the columns and return the index. */
private int valueToIndex(JTableHeader header, String value) {
  int size = header.getColumnModel().getColumnCount();
  for (int i=0;i < size;i++) {
    String str = header.getTable().getModel().getColumnName(i);
    if (ExtendedComparator.stringsMatch(value, str)) {
      return i;
    }
  }
  return -1;
}

代码示例来源:origin: com.opensymphony/webwork

public void setModel(TableModel model) {
  this.model = model;
  columns = new WebTableColumn[this.model.getColumnCount()];
  for (int i = 0; i < columns.length; ++i) {
    columns[i] = new WebTableColumn(this.model.getColumnName(i), i);
  }
  if ((sortableAttr) && !(this.model instanceof SortableTableModel)) {
    this.model = new SortFilterModel(this.model);
  }
}

代码示例来源:origin: xyz.cofe/gui.swing

@Override
public String getColumnName(int columnIndex) {
  if( tableModels==null )return "?";
  if( tableModels.size()==0 )return "?";
  Pair<TableModel,Integer> pTC = getTMColumn(columnIndex);
  if( pTC==null )return "?";
  return pTC.A().getColumnName(pTC.B());
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

public BuTable createValuesTable(final ZCalqueAffichageDonneesInterface _layer) {
 final BuTable r = new CtuluTable(new ImgTableModel());
 EbliTableInfoPanel.setTitle(r, _layer.getTitle());
 EbliTableInfoPanel.setComponent(r, new BuLabel("<html>"
   + EbliLib.getS("Les coordonnes de l'image sont donnes  partir d'en bas  droite.")
   + "<br>"
   + EbliLib.getS("La colonne '{0}' du tableau permet de connatre l'ordonne du point depuis le haut de l'image",
     r.getModel().getColumnName(3))));
 return r;
}

相关文章