那两个application之间如何通信呢?只能传传参数,不能实时监听吗?

解决方案 »

  1.   

    用个危险的办法,把B中的Component设置成static再控制怎么样?
      

  2.   

    interface myListener{
        actionPerformed(){
        }
    }class A{
       myListener ls = new myListenerAdapter();
       A(){
           new B().addListener( this.ls );
       }
       class myListenerAdapter extends myListener(){
            actionPerformed(){
                //do what you want 
            }
       }}class B{
       myListener ls = null;
       public void addListener( myListener param ){
           this.ls = param;
       }
       public void actionPerformed(){
           if( this.ls != null ){
               this.ls.actionPerformed();
           }
       }   onButtonClicked(){
           this.actionPerformed();
       }}
      

  3.   

    请问 bluesmile979(笑着) "interface myListener
    {actionPerformed(){}
    }"写在哪里?就这样写好像有错