类sun.awt.EmbeddedFrame源码实例Demo

下面列出了怎么用sun.awt.EmbeddedFrame的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk1.8-source-analysis   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码2 项目: TencentKona-8   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码3 项目: jdk8u-dev-jdk   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码4 项目: jdk8u60   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码5 项目: JDKSourceCode1.8   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码7 项目: Bytecoder   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
@SuppressWarnings("deprecation")
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码8 项目: openjdk-jdk9   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
@SuppressWarnings("deprecation")
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码9 项目: jdk8u-jdk   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码10 项目: Java8CN   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码11 项目: hottub   文件: PopupFactory.java
/**
 * Obtains the appropriate <code>Popup</code> based on
 * <code>popupType</code>.
 */
private Popup getPopup(Component owner, Component contents,
                       int ownerX, int ownerY, int popupType) {
    if (GraphicsEnvironment.isHeadless()) {
        return getHeadlessPopup(owner, contents, ownerX, ownerY);
    }

    switch(popupType) {
    case LIGHT_WEIGHT_POPUP:
        return getLightWeightPopup(owner, contents, ownerX, ownerY);
    case MEDIUM_WEIGHT_POPUP:
        return getMediumWeightPopup(owner, contents, ownerX, ownerY);
    case HEAVY_WEIGHT_POPUP:
        Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
        if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
            OSInfo.OSType.MACOSX) && (owner != null) &&
            (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
            ((HeavyWeightPopup)popup).setCacheEnabled(false);
        }
        return popup;
    }
    return null;
}
 
源代码12 项目: dragonwell8_jdk   文件: XEmbeddedFramePeer.java
public XEmbeddedFramePeer(EmbeddedFrame target) {
    // Don't specify PARENT_WINDOW param here. Instead we reparent
    // this embedded frame peer to the proper parent window after
    // an XEventDispatcher is registered to handle XEmbed events
    super(new XCreateWindowParams(new Object[] {
        TARGET, target,
        VISIBLE, Boolean.TRUE,
        EMBEDDED, Boolean.TRUE}));
}
 
private static EmbeddedFrame createEmbeddedFrame() {
    try {
        return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance();
    } catch (Exception e) {
        throw new RuntimeException("Cannot create EmbeddedFrame", e);
    }
}
 
源代码14 项目: TencentKona-8   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码15 项目: TencentKona-8   文件: XEmbeddedFramePeer.java
public XEmbeddedFramePeer(EmbeddedFrame target) {
    // Don't specify PARENT_WINDOW param here. Instead we reparent
    // this embedded frame peer to the proper parent window after
    // an XEventDispatcher is registered to handle XEmbed events
    super(new XCreateWindowParams(new Object[] {
        TARGET, target,
        VISIBLE, Boolean.TRUE,
        EMBEDDED, Boolean.TRUE}));
}
 
private static EmbeddedFrame createEmbeddedFrame() {
    try {
        return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance();
    } catch (Exception e) {
        throw new RuntimeException("Cannot create EmbeddedFrame", e);
    }
}
 
源代码17 项目: jdk8u60   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            // JDK-8056915: Try to request focus to the embedder first and
            // activate the embedded frame through it
            if (!((EmbeddedFrame) parent).requestFocusToEmbedder()) {
                // Otherwise activate the embedded frame directly
                ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
            }
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码18 项目: openjdk-8   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            ((EmbeddedFrame)parent).synthesizeWindowActivation(true);
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码19 项目: openjdk-jdk8u   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码20 项目: hottub   文件: XEmbeddedFramePeer.java
public XEmbeddedFramePeer(EmbeddedFrame target) {
    // Don't specify PARENT_WINDOW param here. Instead we reparent
    // this embedded frame peer to the proper parent window after
    // an XEventDispatcher is registered to handle XEmbed events
    super(new XCreateWindowParams(new Object[] {
        TARGET, target,
        VISIBLE, Boolean.TRUE,
        EMBEDDED, Boolean.TRUE}));
}
 
源代码21 项目: openjdk-8-source   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            ((EmbeddedFrame)parent).synthesizeWindowActivation(true);
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码22 项目: openjdk-jdk8u   文件: XEmbeddedFramePeer.java
public XEmbeddedFramePeer(EmbeddedFrame target) {
    // Don't specify PARENT_WINDOW param here. Instead we reparent
    // this embedded frame peer to the proper parent window after
    // an XEventDispatcher is registered to handle XEmbed events
    super(new XCreateWindowParams(new Object[] {
        TARGET, target,
        VISIBLE, Boolean.TRUE,
        EMBEDDED, Boolean.TRUE}));
}
 
private static EmbeddedFrame createEmbeddedFrame() {
    try {
        return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance();
    } catch (Exception e) {
        throw new RuntimeException("Cannot create EmbeddedFrame", e);
    }
}
 
源代码24 项目: openjdk-jdk8u-backup   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码25 项目: jdk8u_jdk   文件: WindowOwnedByEmbeddedFrameTest.java
private static EmbeddedFrame createEmbeddedFrame() {
    try {
        return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance();
    } catch (Exception e) {
        throw new RuntimeException("Cannot create EmbeddedFrame", e);
    }
}
 
源代码26 项目: openjdk-jdk8u-backup   文件: XEmbeddedFramePeer.java
public XEmbeddedFramePeer(EmbeddedFrame target) {
    // Don't specify PARENT_WINDOW param here. Instead we reparent
    // this embedded frame peer to the proper parent window after
    // an XEventDispatcher is registered to handle XEmbed events
    super(new XCreateWindowParams(new Object[] {
        TARGET, target,
        VISIBLE, Boolean.TRUE,
        EMBEDDED, Boolean.TRUE}));
}
 
源代码27 项目: openjdk-jdk9   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码28 项目: jdk8u-dev-jdk   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            // JDK-8056915: Try to request focus to the embedder first and
            // activate the embedded frame through it
            if (!((EmbeddedFrame) parent).requestFocusToEmbedder()) {
                // Otherwise activate the embedded frame directly
                ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
            }
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
源代码29 项目: jdk8u-jdk   文件: XEmbeddedFramePeer.java
public XEmbeddedFramePeer(EmbeddedFrame target) {
    // Don't specify PARENT_WINDOW param here. Instead we reparent
    // this embedded frame peer to the proper parent window after
    // an XEventDispatcher is registered to handle XEmbed events
    super(new XCreateWindowParams(new Object[] {
        TARGET, target,
        VISIBLE, Boolean.TRUE,
        EMBEDDED, Boolean.TRUE}));
}
 
源代码30 项目: hottub   文件: AppletPanel.java
private void setDefaultFocus() {
    Component toFocus = null;
    Container parent = getParent();

    if(parent != null) {
        if (parent instanceof Window) {
            toFocus = getMostRecentFocusOwnerForWindow((Window)parent);
            if (toFocus == parent || toFocus == null) {
                toFocus = parent.getFocusTraversalPolicy().
                    getInitialComponent((Window)parent);
            }
        } else if (parent.isFocusCycleRoot()) {
            toFocus = parent.getFocusTraversalPolicy().
                getDefaultComponent(parent);
        }
    }

    if (toFocus != null) {
        if (parent instanceof EmbeddedFrame) {
            ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
        }
        // EmbeddedFrame might have focus before the applet was added.
        // Thus after its activation the most recent focus owner will be
        // restored. We need the applet's initial focusabled component to
        // be focused here.
        toFocus.requestFocusInWindow();
    }
}
 
 类所在包
 类方法
 同包方法