你的MouseListen没有指定那个存在参数的构造函数
你必须增加一个。你可以初始化多个的MouseListen的实例,或者传递那个Button的对象到
这个Listen中,那样就可以知道那个Button了

解决方案 »

  1.   

    e.getActionCommand()获得按钮名字
    if(e.getSource() instanceof JButton){
              
    }来判断是否是按纽
      

  2.   

    public void MouseListen(KeyEventTest p){
    parent=p;

    }  here no void will be okObject source = e.getSource()
    if( source == button_name ){
       do what you want
    }
      

  3.   

    没有啊,我不是已经声明了一个带参数的构造函数吗?
    public void MouseListen(KeyEventTest p){
    parent=p;

    }
      

  4.   

    晕,看没看我写的东西啊没有voidvoid也是一种返回值,构造函数不能有任何的返回值。