當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。