SwingUIUtils.java 文件源码

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

项目:hiervis 作者:
/**
 * Creates and registers a {@link WindowListener} to {@code window}, which executes the callback expression.
 * 
 * @param window
 *            the window whose closing will cause the callback to be executed.
 * @param callback
 *            the callback to execute when the window closes.
 * @return the created listener
 */
public static WindowListener addCloseCallback( Window window, Runnable callback )
{
    WindowListener listener = new WindowAdapter() {
        @Override
        public void windowClosing( WindowEvent e )
        {
            callback.run();
        }
    };
    window.addWindowListener( listener );
    return listener;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号