[英]JTable listen for entering editing mode
This is a pretty simple question, but I couldn't find an answer nonetheless (please forgive my clumsy searching ...). 这是一个非常简单的问题,但是我仍然找不到答案(请原谅我笨拙的搜索...)。 There's a Jtable with editable cells and I want to detect when a cell is being entered for editing (for instance by double-clicking).
有一个带有可编辑单元格的Jtable,我想检测何时输入一个单元格进行编辑(例如,双击)。 How would I do this?
我该怎么做?
Add a PropertyChangeListener
to the JTable
: 将
PropertyChangeListener
添加到JTable
:
//
// Implement the PropertyChangeListener interface
//
@Override
public void propertyChange(PropertyChangeEvent e)
{
// A cell has started/stopped editing
if ("tableCellEditor".equals(e.getPropertyName()))
{
if (table.isEditing())
// code for editing started;
else
// code for editing stopped;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.