KDTable监听事件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/exit_dghn/article/details/78752596

***EDITUI.java

在onShow()方法下调用

this.kdtEntrys.setBeforeAction(new TableBeforeAction());


当前类下添加子类

class TableBeforeAction implements BeforeActionListener { 
        public void beforeAction(BeforeActionEvent e) {
            // 添加行
            if (e.getType() == BeforeActionEvent.ACTION_ADD_ROW)
            {
                // 获取插入行的位置
                int rowIndex = ((Integer)e.getParameter()).intValue();
                if (rowIndex > 5) {
                    MsgBox.showInfo("很抱歉!不能再加行啦~");
                    // 取消动作
                    e.setCancel(true);
                }
            }
        }
    }

猜你喜欢

转载自blog.csdn.net/exit_dghn/article/details/78752596