用回调函数。在回调函数里写table.editCellAt(row, column);

解决方案 »

  1.   

    public interface A()
    {
      public void edit(int row, int column);
    }主程序实现该接口:
    public void edit(int row, int column)
    {
      table.editCellAt(row, column);
    }
    public void init()//主程序的初始化表格方法
    {
      tableModel tm = new tableModel(this);
      table.setModel(tm);
    }
    tableModel类:
    类成员变量:A a;
    构造函数:
    public tableModel(A a)

      this.a = a;

    在tableModel里面有个方法:
    private void checkValue()
    {
      //if value at row, column is not a legal value
      a.edit(row, column);
    }