ONLSettings.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:java-open-nl 作者:
public static void onJFrameClose_Disconnect(JFrame frame) {
    if(frame != null) {
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                if(Server.isHosting() || Client.isConnected()) {
                    if(Server.isHosting()) {
                        Server.shutdown("");
                    }else {
                        Client.disconnect();
                    }
                }
            }
        });
    }else {
        System.out.println("Can't add Window Event on a null JFrame.");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号