src/macosx/classes/com/apple/laf/ScreenPopupFactory.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -26,11 +26,13 @@
 package com.apple.laf;
 
 import java.awt.*;
 import javax.swing.*;
 
+import sun.awt.EmbeddedFrame;
 import sun.lwawt.macosx.CPlatformWindow;
+import sun.swing.SwingAccessor;
 
 class ScreenPopupFactory extends PopupFactory {
     static {
         java.security.AccessController.doPrivileged(
             new java.security.PrivilegedAction<Void>() {

@@ -74,10 +76,14 @@
             popup = _getHeavyWeightPopup(comp, invoker, x, y);
         } else {
             popup = super.getPopup(comp, invoker, x, y);
         }
 
+        if (EmbeddedFrame.getAppletIfAncestorOf(comp) != null) {
+            SwingAccessor.getPopupFactoryAccessor().setHeavyWeightPopupCacheEnabled(popup, false);
+        }
+
         // Make the popup semi-translucent if it is a heavy weight
         // see <rdar://problem/3547670> JPopupMenus have incorrect background
         final Window w = getWindow(invoker);
         if (w == null) return popup;