XComponentPeer.java 文件源码

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

项目:jdk7-jdk 作者:
public void handleButtonPressRelease(XEvent xev) {
    /*
     * Fix for 6385277.
     * We request focus on simple Window by click in order
     * to make it behave like Frame/Dialog in this case and also to unify
     * the behaviour with what we have on MS Windows.
     * handleJavaMouseEvent() would be more suitable place to do this
     * but we want Swing to have this functionality also.
     */
    if (xev.get_type() == XConstants.ButtonPress) {
        final XWindowPeer parentXWindow = getParentTopLevel();
        Window parentWindow = (Window)parentXWindow.getTarget();
        if (parentXWindow.isFocusableWindow() && parentXWindow.isSimpleWindow() &&
            XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow() != parentWindow)
        {
            postEvent(new InvocationEvent(parentWindow, new  Runnable() {
                    public void run() {
                        // Request focus on the EDT of 'parentWindow' because
                        // XDecoratedPeer.requestWindowFocus() calls client code.
                        parentXWindow.requestXFocus();
                    }
                }));
        }
    }
    super.handleButtonPressRelease(xev);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号