和http://expert.csdn.net/Expert/topic/1785/1785560.xml?temp=.210705一并给分

解决方案 »

  1.   

    将applicationA的窗体作为参数传到applicationB,如:
    在A中
    new applicationB(this);
    在B的构造函数中接收
    public applictionB(applicationA a)
      

  2.   

    多谢beyond_xiruo(乱谈情) ,能否再说得具体一些?
    A中
    ?=new applicationB(this);
    在A的构造函数中吗?还是main中?
    JBuilder中
      public applictionB(applicationA a)
    {
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        try {
          jbInit();
        }
        catch(Exception e) {
          e.printStackTrace();
        }
      }
      //Component initialization
      private void jbInit() throws Exception  
    {如何把a传到这里?}
      

  3.   

    请yuanmeng163(今天我有空) 也帮忙解答,
    昨天一个类似问题你给出了较好的答案。
    今天继续给分,多谢
      

  4.   

    ????刚才刚给另一个帖子做的,你们老师留作业?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();
       }}
      

  5.   

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

  6.   

    晕,我直接写的,主要是把思路写给你。哪里有问题你调试一下嘛。i fu le you.interface myListener{
        void actionPerformed(){
        }
    }class A{
       myListener ls = new myListenerAdapter();
       A(){
           new B().addListener( this.ls );
       }
       class myListenerAdapter implements 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();
           }
       }   void onButtonClicked(){
           this.actionPerformed();
       }}
      

  7.   

    beyond_xiruo(又再次无奈的离开) 的办法我明白了。
    bluesmile979(笑着) 的没看懂,自己的问题。
    在另一贴中你给了相同的答案,我给40分,此贴就少些了