當前位置: 首頁>>代碼示例>>Java>>正文


Java TableCellEditor.addCellEditorListener方法代碼示例

本文整理匯總了Java中javax.swing.table.TableCellEditor.addCellEditorListener方法的典型用法代碼示例。如果您正苦於以下問題:Java TableCellEditor.addCellEditorListener方法的具體用法?Java TableCellEditor.addCellEditorListener怎麽用?Java TableCellEditor.addCellEditorListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.table.TableCellEditor的用法示例。


在下文中一共展示了TableCellEditor.addCellEditorListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: editCellAt

import javax.swing.table.TableCellEditor; //導入方法依賴的package包/類
public boolean editCellAt(int index, EventObject e) {
	if (cellEditor != null && !cellEditor.stopCellEditing()) {
		return false;
	}
	if (!isCellEditable(index)) {
		return false;
	}
	TableCellEditor editor = getCellEditor(index);

	if (editor != null && editor.isCellEditable(e)) {
		editorComp = prepareEditor(editor, index);
		editorComp.setBounds(getHeaderRect(index));
		add(editorComp);
		editorComp.validate();
		setCellEditor(editor);
		setEditingColumn(index);
		editor.addCellEditorListener(this);

		return true;
	}
	return false;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:23,代碼來源:EditableTableHeader.java

示例2: editCellAt

import javax.swing.table.TableCellEditor; //導入方法依賴的package包/類
/**
 * Programmatically starts editing the cell at <code>row</code> and <code>column</code>, if
 * those indices are in the valid range, and the cell at those indices is editable. To prevent
 * the <code>JTable</code> from editing a particular table, column or cell value, return false
 * from the <code>isCellEditable</code> method in the <code>TableModel</code> interface.
 * 
 * @param row
 *            the row to be edited
 * @param column
 *            the column to be edited
 * @param e
 *            event to pass into <code>shouldSelectCell</code>; note that as of Java 2 platform
 *            v1.2, the call to <code>shouldSelectCell</code> is no longer made
 * @return false if for any reason the cell cannot be edited, or if the indices are invalid
 */
@Override
public boolean editCellAt(int row, int column, EventObject e) {
	if (cellEditor != null && !cellEditor.stopCellEditing()) {
		return false;
	}

	if (row < 0 || row >= getRowCount() || column < 0 || column >= getColumnCount()) {
		return false;
	}

	if (!isCellEditable(row, column)) {
		return false;
	}

	TableCellEditor editor = getCellEditor(row, column);
	if (editor != null && editor.isCellEditable(e)) {
		editorComp = prepareEditor(editor, row, column);
		if (editorComp == null) {
			removeEditor();
			return false;
		}
		editorComp.setBounds(getCellRect(row, column, false));
		add(editorComp);
		editorComp.validate();
		editorComp.repaint();

		setCellEditor(editor);
		setEditingRow(row);
		setEditingColumn(column);
		editor.addCellEditorListener(this);

		return true;
	}
	return false;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:51,代碼來源:PropertyTable.java


注:本文中的javax.swing.table.TableCellEditor.addCellEditorListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。