javax.swing.table.TableColumn#setModelIndex ( )源码实例Demo

下面列出了javax.swing.table.TableColumn#setModelIndex ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spotbugs   文件: SorterTableColumnModel.java
@Override
public void moveColumn(int fromIndex, int toIndex) {
    TableColumn from = columnList.get(fromIndex);
    TableColumn to = columnList.get(toIndex);

    columnList.set(fromIndex, to);
    to.setModelIndex(fromIndex);

    columnList.set(toIndex, from);
    from.setModelIndex(toIndex);

    orderUpdate();

    for (TableColumnModelListener w : new ArrayList<>(watchers)) {
        w.columnMoved(new TableColumnModelEvent(this, fromIndex, toIndex));
    }
}
 
源代码2 项目: snap-desktop   文件: ProductEntryTableModel.java
public ProductEntryTableModel(final ProductEntry[] productList, boolean minimalView) {
    this.productEntryList = productList;
    dataProviders.add(new IDProvider());
    dataProviders.add(new PropertiesProvider(minimalView));
    if (!minimalView) {
        try {
            dataProviders.add(new QuicklookProvider());
        } catch (Exception e) {
            e.printStackTrace();
            Dialogs.showError(e.getMessage());
        }
    }
    for (final DataProvider provider : dataProviders) {
        final TableColumn tableColumn = provider.getTableColumn();
        tableColumn.setModelIndex(getColumnCount());
        columnList.add(tableColumn);
    }
}
 
源代码3 项目: rapidminer-studio   文件: MatrixPropertyTable.java
public void removeColumn(int index) {
	TableColumn column = getColumnModel().getColumn(index);
	int modelIndex = column.getModelIndex();
	Vector<?> modelData = model.getDataVector();
	Vector<?> columnIdentifiers = model.getColumnIdentifiers();

	// remove the column from the table
	removeColumn(column);

	// remove the column header from the table model
	columnIdentifiers.removeElementAt(modelIndex);

	// remove the column data
	for (Object row : modelData) {
		((Vector<?>) row).removeElementAt(modelIndex);
	}
	model.setDataVector(modelData, columnIdentifiers);

	// correct the model indices in the TableColumn objects
	Enumeration<TableColumn> columns = getColumnModel().getColumns();
	while (columns.hasMoreElements()) {
		TableColumn currentColumn = columns.nextElement();
		if (currentColumn.getModelIndex() >= modelIndex) {
			currentColumn.setModelIndex(currentColumn.getModelIndex() - 1);
		}
	}
}
 
源代码4 项目: snap-desktop   文件: AOITableModel.java
public AOITableModel(final AOI[] aoiList) {
    this.aoiList = aoiList;
    //dataProviders.add(new IDProvider());
    dataProviders.add(new AOIDetailsProvider());

    for (final DataProvider provider : dataProviders) {
        final TableColumn tableColumn = provider.getTableColumn();
        tableColumn.setModelIndex(getColumnCount());
        columnList.add(tableColumn);
    }
}