src/share/classes/sun/swing/SwingAccessor.java

Print this page

        

@@ -27,10 +27,12 @@
 
 import sun.misc.Unsafe;
 
 import java.awt.Point;
 import javax.swing.RepaintManager;
+import javax.swing.Popup;
+import javax.swing.PopupFactory;
 
 import javax.swing.text.JTextComponent;
 import javax.swing.TransferHandler;
 
 /**

@@ -89,10 +91,21 @@
         void addRepaintListener(RepaintManager rm, SwingUtilities2.RepaintListener l);
         void removeRepaintListener(RepaintManager rm, SwingUtilities2.RepaintListener l);
     }
 
     /**
+     * An accessor for the PopupFctory class.
+     */
+    public interface PopupFactoryAccessor {
+        /**
+         * Enables or disables HeavyWeightPopup cache. If the popup is not
+         * HeavyWeightPopup, the method does nothing.
+         */
+        void setHeavyWeightPopupCacheEnabled(Popup popup, boolean enable);
+    }
+
+    /**
      * The javax.swing.text.JTextComponent class accessor object.
      */
     private static JTextComponentAccessor jtextComponentAccessor;
 
     /**

@@ -154,6 +167,26 @@
         if (repaintManagerAccessor == null) {
             unsafe.ensureClassInitialized(RepaintManager.class);
         }
         return repaintManagerAccessor;
     }
+
+    /**
+     * The PopupFactory class accessor object.
+     */
+    private static PopupFactoryAccessor popupFactoryAccessor;
+
+    /**
+     * Set an accessor object for the PopupFactory class.
+     */
+    public static void setPopupFactoryAccessor(PopupFactoryAccessor accessor) { popupFactoryAccessor = accessor; }
+
+    /**
+     * Retrive the accessor object for the PopupFactory class.
+     */
+    public static PopupFactoryAccessor getPopupFactoryAccessor() {
+        if (popupFactoryAccessor == null) {
+            unsafe.ensureClassInitialized(PopupFactory.class);
+        }
+        return popupFactoryAccessor;
+    }
 }