SwingUIUtils.java 文件源码

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

项目:hiervis 作者:
/**
 * Creates and registers a {@link WindowListener} to {@code parent} window, which causes
 * the {@code child} window to close when the {@code parent} window is closed.
 * 
 * @param parent
 *            the window whose closing will cause child to close as well.
 * @param child
 *            the window that will be closed when parent is closed.
 * @return the created listener
 */
public static WindowListener addCloseCallback( Window parent, Window child )
{
    return addCloseCallback(
        parent, () -> {
            // Dispatch closing event instead of calling dispose() directly,
            // so that event listeners are notified.
            child.dispatchEvent(
                new WindowEvent(
                    child,
                    WindowEvent.WINDOW_CLOSING
                )
            );
        }
    );
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号