JComponent_MultithreadedTest.java 文件源码

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

项目:cn1 作者:
protected void requestFocusForComponent(final JComponent c, final boolean temporarily,
                                        int maxWaitTime) throws Exception {
    FocusListener listener = addFocusListener(c);
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            c.requestFocus(temporarily);
        }
    });

    synchronized (listener) {
        listener.wait(maxWaitTime);
    }
    waitForIdle();
    if (!c.isFocusOwner()) {
        fail();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号