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


Java TableCellEditor.isCellEditable方法代码示例

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


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

import javax.swing.table.TableCellEditor; //导入方法依赖的package包/类
@Override
public boolean isCellEditable(EventObject anEvent) {
    if (!(anEvent.getSource() instanceof Outline)) {
        return false;
    }
    Outline outline = (Outline) anEvent.getSource();
    int row;
    if (anEvent instanceof MouseEvent) {
        MouseEvent event = (MouseEvent) anEvent;
        Point p = event.getPoint();
        // Locate the editor under the event location
        //int column = outline.columnAtPoint(p);
        row = outline.rowAtPoint(p);
    } else {
        row = outline.getSelectedRow();
    }
    Node n = DelegatingCellRenderer.getNodeAt(outline, row);
    if (n instanceof TreeModelNode) {
        TreeModelNode tmn = (TreeModelNode) n;
        TableRendererModel trm = tmn.getModel();
        try {
            boolean canEdit = trm.canEditCell(tmn.getObject(), columnID);
            if (canEdit) {
                TableCellEditor tce = trm.getCellEditor(tmn.getObject(), columnID);
                canEdit = tce.isCellEditable(anEvent);
                return canEdit;
            }
        } catch (UnknownTypeException ex) {
        }
    }
    return defaultEditor.isCellEditable(anEvent);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:DelegatingCellEditor.java

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