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


Java TableColumnModel.getColumnCount方法代码示例

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


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

示例1: setColumnsData

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private void setColumnsData() {
    barRenderer = getBarCellRenderer();

    TableColumnModel colModel = resTable.getColumnModel();
    colModel.getColumn(0).setPreferredWidth(minNamesColumnWidth);

    int index;

    for (int i = 0; i < colModel.getColumnCount(); i++) {
        index = resTableModel.getRealColumn(i);

        if (index == 0) {
            colModel.getColumn(i).setPreferredWidth(minNamesColumnWidth);
        } else {
            colModel.getColumn(i).setPreferredWidth(columnWidths[index - 1]);
        }

        if (index == 1) {
            colModel.getColumn(i).setCellRenderer(barRenderer);
        } else {
            colModel.getColumn(i).setCellRenderer(columnRenderers[index]);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AllocResultsPanel.java

示例2: createDefaultColumnsFromModel

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
@Override
public void createDefaultColumnsFromModel() {
    TableModel m = getModel();
    if( m != null ) {
        // Remove any current columns
        TableColumnModel cm = getColumnModel();
        while( cm.getColumnCount() > 0 ) {
            cm.removeColumn( cm.getColumn(0) );
 }

        // Create new columns from the data model info
        for( int i=0; i<m.getColumnCount(); i++ ) {
            TableColumn newColumn = new MyTableColumn(i);
            if( i == TaskListModel.COL_LOCATION )
                newColumn.setCellRenderer( new LeftDotRenderer() );
            else if( i != TaskListModel.COL_GROUP )
                newColumn.setCellRenderer( new TooltipRenderer() );
            addColumn(newColumn);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TaskListTable.java

示例3: setDefaultColumnSize

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private void setDefaultColumnSize() {
    int width = table.getWidth();
    TableColumnModel columnModel = table.getColumnModel();
    if (columns == null || columnModel == null)
        return;
    if (columnModel.getColumnCount() != columns.length)
        return;
    for (int i = 0; i < columns.length; i++) {
        String col = columns[i];                                
        sorter.setColumnComparator(i, null);                    
        if (col.equals(PropertiesTableModel.COLUMN_NAME_NAME)) {
            columnModel.getColumn(i).setPreferredWidth(width * 20 / 100);
        } else if (col.equals(PropertiesTableModel.COLUMN_NAME_VALUE)) {
            columnModel.getColumn(i).setPreferredWidth(width * 40 / 100);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:PropertiesTable.java

示例4: adjustColumnRatios

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
public void adjustColumnRatios()
{
	TableColumnModel m = getColumnModel();
	if (m == null) return;
	TableColumn c;
	int ii;
	for (ii = 0; ii < m.getColumnCount()-1; ii++)
	{
		c = m.getColumn(ii);
		c.setCellRenderer(seqRenderer);
		c.setMinWidth(35);
		c.setPreferredWidth(100);
		c.setMaxWidth(Integer.MAX_VALUE/2);
	}

	if (ii < m.getColumnCount())
	{
		c = m.getColumn(ii);
		c.setCellRenderer(totalRenderer);
		c.setMinWidth(70);
		c.setPreferredWidth(200);
		c.setMaxWidth(Integer.MAX_VALUE);
	}
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:25,代码来源:Timer.java

示例5: paintVerticalLines

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private void paintVerticalLines(Graphics g) {
    int height = getHeight();
    int viewHeight = view.getHeight();
    if (viewHeight >= height) return;

    g.setColor(background);
    g.fillRect(0, viewHeight, getWidth(), getHeight() - viewHeight);

    int cellX = 0;
    int cellWidth;
    TableColumnModel model = view.getColumnModel();
    int columnCount = model.getColumnCount();
    
    g.setColor(DetailsTable.DEFAULT_GRID_COLOR);
    for (int i = 0; i < columnCount; i++) {
        cellWidth = model.getColumn(i).getWidth();
        cellX += cellWidth;
        g.drawLine(cellX - 1, viewHeight, cellX - 1, height);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:DetailsPanel.java

示例6: adjustColumnWidths

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
protected void adjustColumnWidths() {
    TableColumnModel colModel = getColumnModel();
    for( int i=0; i<colModel.getColumnCount(); i++ ) {
        TableColumn tc = colModel.getColumn( i );
        int colWidth = 0;
        for( int row=0; row<getRowCount(); row++ ) {
            colWidth = Math.max( renderer.getPreferredWidth( getValueAt( row, i ) ), colWidth );
        }
        colWidth = Math.max( colWidth, 30 );
        colWidth += getIntercellSpacing().width;
        tc.setWidth( colWidth );
        tc.setMinWidth( colWidth );
        tc.setMaxWidth( colWidth );
        tc.setPreferredWidth( colWidth );
        tc.setResizable( false );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:TabTable.java

示例7: setDefaultColumnSize

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private void setDefaultColumnSize() {
    int width = table.getWidth();
    TableColumnModel columnModel = table.getColumnModel();
    if (columns == null || columnModel == null)
        return;
    if (columnModel.getColumnCount() != columns.length)
        return;
    for (int i = 0; i < columns.length; i++) {
        String col = columns[i];                                
        if (col.equals(PropertiesTableModel.COLUMN_NAME_NAME)) {
            columnModel.getColumn(i).setPreferredWidth(width * 20 / 100);
        } else if (col.equals(PropertiesTableModel.COLUMN_NAME_VALUE)) {
            columnModel.getColumn(i).setPreferredWidth(width * 40 / 100);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:PropertiesTable.java

示例8: createHeaderSize

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
/**
 * Calculate and return the dimension of the header.
 *
 * @param width Starting width to be used.
 * @return Dimension of the header
 */
private Dimension createHeaderSize(long width) {
    TableColumnModel columnModel = header.getColumnModel();
    width += columnModel.getColumnMargin() * columnModel.getColumnCount();
    if (width > Integer.MAX_VALUE) {
        width = Integer.MAX_VALUE;
    }
    return new Dimension((int) width, getHeaderHeight());
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:15,代码来源:GroupableTableHeaderUI.java

示例9: viewIndexForColumn

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
/**
 * (copy & paste from BasicTableUI)
 */
private int viewIndexForColumn(TableColumn aColumn) {
    TableColumnModel cm = table.getColumnModel();
    for (int column = 0; column < cm.getColumnCount(); column++) {
        if (cm.getColumn(column) == aColumn) {
            return column;
        }
    }
    return -1;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TaskListTableUI.java

示例10: viewIndexForColumn

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private int viewIndexForColumn(TableColumn aColumn) {
    TableColumnModel cm = table.getColumnModel();
    for (int column = 0; column < cm.getColumnCount(); column++) {
        if (cm.getColumn(column) == aColumn) {
            return column;
        }
    }
    return -1;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:SynthTableUI.java

示例11: createDefaultColumnsFromModel

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
@Override
public void createDefaultColumnsFromModel() {
	TableModel m = getModel();
	if (m != null) {
		// Remove any current columns
		TableColumnModel cm = getColumnModel();
		while (cm.getColumnCount() > 0) {
			cm.removeColumn(cm.getColumn(0));
		}

		// Create one column only
		TableColumn newColumn = new TableColumn(0);
		addColumn(newColumn);
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:16,代码来源:RowHeader.java

示例12: findmatch

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
private List<IJavaElement> findmatch(ArrayList<IJavaElement> r, PropertyPredicate p) {
    JTableHeader header = (JTableHeader) component;
    TableColumnModel columnModel = header.getColumnModel();
    int col = columnModel.getColumnCount();
    for (int i = 0; i < col; i++) {
        JTableHeaderItemJavaElement e = new JTableHeaderItemJavaElement(this, i);
        if (p.isValid(e)) {
            r.add(e);
        }
    }
    return r;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:13,代码来源:JTableHeaderJavaElement.java

示例13: setColumnSizes

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
@Override
public void setColumnSizes(TableColumnModelEvent e)
{
	TableColumnModel tcm = (TableColumnModel)e.getSource();
	int cc = tcm.getColumnCount();
	if (cc <= 1) return;

	setColumnWidths(tcm.getColumn(0), 40, 60, 75);
	setColumnWidths(tcm.getColumn(1), 80, 250, 400);
	doLayout();
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:12,代码来源:DriverTable.java

示例14: adjustRenderers

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
public void adjustRenderers()
{
	TableColumnModel m = getColumnModel();
	if (m.getColumnCount() > 1)
		adjustSeqRenderer(m.getColumn(0).getWidth());
	int newFontSize = adjustFinalRenderer(m.getColumn(m.getColumnCount()-1).getWidth());

	setRowHeight((int)(newFontSize*1.5));
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:10,代码来源:Timer.java

示例15: viewIndexForColumn

import javax.swing.table.TableColumnModel; //导入方法依赖的package包/类
/**
 * Get the view column index of the given table column
 *
 * @param aColumn
 * @return
 */
private int viewIndexForColumn(TableColumn aColumn) {
	TableColumnModel cm = TableHeaderUI.this.header.getColumnModel();
	for (int column = 0; column < cm.getColumnCount(); column++) {
		if (cm.getColumn(column) == aColumn) {
			return column;
		}
	}
	return -1;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:16,代码来源:TableHeaderUI.java


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