当前位置: 首页>>代码示例>>Java>>正文


Java TableColumnModel.addColumn方法代码示例

本文整理汇总了Java中javax.swing.table.TableColumnModel.addColumn方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnModel.addColumn方法的具体用法?Java TableColumnModel.addColumn怎么用?Java TableColumnModel.addColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.table.TableColumnModel的用法示例。


在下文中一共展示了TableColumnModel.addColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recreateTableColumn

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
protected void recreateTableColumn(TableColumnModel columnModel) {
	int n = columnModel.getColumnCount();
	EditableTableHeaderColumn[] newCols = new EditableTableHeaderColumn[n];
	TableColumn[] oldCols = new TableColumn[n];
	for (int i = 0; i < n; i++) {
		oldCols[i] = columnModel.getColumn(i);
		newCols[i] = new EditableTableHeaderColumn(i);
		newCols[i].copyValues(oldCols[i]);
	}
	for (int i = 0; i < n; i++) {
		columnModel.removeColumn(oldCols[i]);
	}
	for (int i = 0; i < n; i++) {
		columnModel.addColumn(newCols[i]);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:EditableTableHeader.java

示例2: getJTableOptions

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
public static void getJTableOptions(final String name, final JTable table,
                                    final Properties properties) {
    final Integer colCount = getObjectInteger(name + "_col_count",
            properties);
    if (colCount == null || colCount.intValue() != table.getColumnCount())
        return;
    final String cNames[] = new String[table.getColumnCount()];
    final Object cols[] = new Object[table.getColumnCount()];

    for (int i = 0; i < cNames.length; i++) {
        cNames[i] = table.getColumnName(i);
        cols[i] = table.getColumnModel().getColumn(i);
    }

    for (final String element : cNames) {
        final int width = getInteger(name + "_col_" + element + "_width",
                table.getColumn(element).getWidth(), properties);
        table.getColumn(element).setPreferredWidth(width);
    }

    final TableColumnModel cm = table.getColumnModel();
    final int tci[] = new int[cNames.length];
    for (int i = 0; i < cNames.length; i++)
        cm.removeColumn((TableColumn) cols[i]);

    for (int i = 0; i < cNames.length; i++) {
        tci[i] = getInteger(name + "_col_" + cNames[i] + "_index", i,
                properties);
    }

    for (int i = 0; i < cNames.length; i++)
        for (int j = 0; j < cNames.length; j++)
            if (tci[j] == i)
                cm.addColumn((TableColumn) cols[j]);

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:37,代码来源:Options.java

示例3: getJTableOptions

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
public static void getJTableOptions(final String name, final JTable table,
                                    final Properties properties) {
    final Integer colCount = getObjectInteger(name + "_col_count",
            properties);
    if (colCount == null || colCount.intValue() != table.getColumnCount())
        return;
    final Object cols[] = new Object[table.getColumnCount()];

    for (int i = 0; i < colCount.intValue(); i++) {
        cols[i] = table.getColumnModel().getColumn(
                table.convertColumnIndexToView(i));
    }

    for (int i = 0; i < colCount.intValue(); i++) {
        try {
            int index = table.convertColumnIndexToView(i);
            final int width = getInteger(name + "_col_" + i + "_width",
                    table.getColumnModel().getColumn(index).getWidth(),
                    properties);
            table.getColumnModel().getColumn(index)
                    .setPreferredWidth(width);
        } catch (Exception e) {

        }
    }

    final TableColumnModel cm = table.getColumnModel();
    final int tci[] = new int[colCount.intValue()];
    for (int i = 0; i < colCount.intValue(); i++)
        cm.removeColumn((TableColumn) cols[i]);

    for (int i = 0; i < colCount.intValue(); i++) {
        tci[i] = getInteger(name + "_col_" + i + "_index", i, properties);
    }

    for (int i = 0; i < colCount.intValue(); i++)
        for (int j = 0; j < colCount.intValue(); j++)
            if (tci[j] == i)
                cm.addColumn((TableColumn) cols[j]);

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:42,代码来源:Options.java


注:本文中的javax.swing.table.TableColumnModel.addColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。