简体   繁体   English

键盘的TableModelListener事件

[英]TableModelListener event from keyboard

I Have a Jtable where a TableModelListener is listening 我有一个JTable,其中TableModelListener正在侦听

Implemented by 实施者

private void anadeListenerAlModelo() {
    tabla.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent evento) {
            if (evento.getType() == TableModelEvent.UPDATE) {
                System.out.println("Editing...");
            }
        }
    });
}

And I want to detect when a cell is being edit but only if is edit from de keyboard, because, other events could update the content. 而且我想检测何时正在编辑单元格,但仅当通过键盘进行编辑时才可以,因为其他事件可能会更新内容。

I only need when the user is editing a cell from the keyboard. 我只在用户通过键盘编辑单元格时才需要。 It's this posible? 这是可能的吗?

Thanks! 谢谢!

Check out the Table Cell Listener . 检出Table Cell Listener

It listens for PropertyChange events on the table for when the cell editor is activated/deactivated and then notifies you when the data in the cell has actually been changed. 它侦听表上的PropertyChange事件,以了解何时激活/停用单元格编辑器,然后在单元格中的数据实际更改时通知您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM