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


Java TableModel.setValueAt方法代码示例

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


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

示例1: mouseClicked

import javax.swing.table.TableModel; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
    JTableHeader header = (JTableHeader) e.getSource();
    JTable table = header.getTable();
    TableColumnModel columnModel = table.getColumnModel();
    int vci = columnModel.getColumnIndexAtX(e.getX());
    int mci = table.convertColumnIndexToModel(vci);
    if (mci == targetColumnIndex) {
        if (SwingUtilities.isLeftMouseButton(e)) {
            TableColumn column = columnModel.getColumn(vci);
            Object v = column.getHeaderValue();
            boolean b = Status.DESELECTED.equals(v);
            TableModel m = table.getModel();
            for (int i = 0; i < m.getRowCount(); i++) {
                m.setValueAt(b, i, mci);
            }
            column.setHeaderValue(b ? Status.SELECTED : Status.DESELECTED);
        } else if (SwingUtilities.isRightMouseButton(e)) {
            if (popupMenu != null) {
                popupMenu.show(table, e.getX(), 0);
            }
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:25,代码来源:TableCheckBoxColumn.java

示例2: restoreDefaultsButtonActionPerformed

import javax.swing.table.TableModel; //导入方法依赖的package包/类
/**
 * reverts the selected state of all the detectors to their defaults as specified in the findbugs.xml file
 *
 * @param evt the swing event corresponding to the mouse click of the Restore Defaults button
 */
private void restoreDefaultsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restoreDefaultsButtonActionPerformed
	Iterator<DetectorFactory> i = DetectorFactoryCollection.instance().factoryIterator();
	DefaultSortedTableModel sorter = (DefaultSortedTableModel) detectorTable.getModel();
	TableModel model = sorter.getBaseTableModel();
	int row = 0;
	while (i.hasNext()) {
		DetectorFactory factory = i.next();
		model.setValueAt(factory.isDefaultEnabled() ? Boolean.TRUE : Boolean.FALSE, row++, ENABLED_COLUMN);
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:ConfigureDetectorsDialog.java

示例3: setValueAt

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public void setValueAt(int y, int x, boolean val){
    JTableOperator table = new JTableOperator(this, 0); 
    JTable t = ((JTable)table.getSource());                
    TableModel model = t.getModel();
    model.setValueAt(val, y, x);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:PullUpOperator.java

示例4: selectProjectByIndex

import javax.swing.table.TableModel; //导入方法依赖的package包/类
protected static void selectProjectByIndex(TableModel model, int index) {
    model.setValueAt(true, index, 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ProjectImporterTestCase.java


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