一个聊天儿程序..当客户端这边关闭时,服务器这里就可以马上显示,XXX客户以下线,如何去判断呢..请朋友帮帮助....

解决方案 »

  1.   

    添加WindowListener重载里面的windowClosing方法
      

  2.   

    感觉这两个方法应该都可以windowClosing
    void windowClosing(WindowEvent e)
    Invoked when the user attempts to close the window from the window's system menu. 
    --------------------------------------------------------------------------------windowClosed
    void windowClosed(WindowEvent e)
    Invoked when a window has been closed as the result of calling dispose on the window.