sun.awt.EmbeddedFrame Java Examples
The following examples show how to use
sun.awt.EmbeddedFrame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PopupFactory.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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; }
Example #2
Source File: PopupFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #3
Source File: PopupFactory.java From Java8CN with Apache License 2.0 | 6 votes |
/** * 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; }
Example #4
Source File: PopupFactory.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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; }
Example #5
Source File: PopupFactory.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * 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; }
Example #6
Source File: PopupFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #7
Source File: PopupFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #8
Source File: PopupFactory.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #9
Source File: PopupFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #10
Source File: PopupFactory.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #11
Source File: PopupFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #12
Source File: AppletPanel.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #13
Source File: XEmbeddedFramePeer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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})); }
Example #14
Source File: WindowOwnedByEmbeddedFrameTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static EmbeddedFrame createEmbeddedFrame() { try { return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance(); } catch (Exception e) { throw new RuntimeException("Cannot create EmbeddedFrame", e); } }
Example #15
Source File: AppletPanel.java From hottub with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #16
Source File: AppletPanel.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #17
Source File: WindowOwnedByEmbeddedFrameTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static EmbeddedFrame createEmbeddedFrame() { try { return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance(); } catch (Exception e) { throw new RuntimeException("Cannot create EmbeddedFrame", e); } }
Example #18
Source File: WindowOwnedByEmbeddedFrameTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static EmbeddedFrame createEmbeddedFrame() { try { return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance(); } catch (Exception e) { throw new RuntimeException("Cannot create EmbeddedFrame", e); } }
Example #19
Source File: XEmbeddedFramePeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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})); }
Example #20
Source File: AppletPanel.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #21
Source File: XEmbeddedFramePeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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})); }
Example #22
Source File: WindowOwnedByEmbeddedFrameTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static EmbeddedFrame createEmbeddedFrame() { try { return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance(); } catch (Exception e) { throw new RuntimeException("Cannot create EmbeddedFrame", e); } }
Example #23
Source File: XEmbeddedFramePeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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})); }
Example #24
Source File: XEmbeddedFramePeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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})); }
Example #25
Source File: AppletPanel.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #26
Source File: AppletPanel.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #27
Source File: AppletPanel.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #28
Source File: AppletPanel.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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(); } }
Example #29
Source File: XEmbeddedFramePeer.java From hottub with GNU General Public License v2.0 | 5 votes |
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})); }
Example #30
Source File: AppletPanel.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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(); } }