< prev index next >

src/java.desktop/share/classes/javax/swing/PopupFactory.java

Print this page




 243         // correctly.
 244         Component c = owner;
 245         while (c != null) {
 246             if (c instanceof JComponent) {
 247                 if (((JComponent)c).getClientProperty(
 248                             PopupFactory_FORCE_HEAVYWEIGHT_POPUP) == Boolean.TRUE) {
 249                     popupType = HEAVY_WEIGHT_POPUP;
 250                     break;
 251                 }
 252             }
 253             c = c.getParent();
 254         }
 255 
 256         return popupType;
 257     }
 258 
 259     /**
 260      * Obtains the appropriate <code>Popup</code> based on
 261      * <code>popupType</code>.
 262      */

 263     private Popup getPopup(Component owner, Component contents,
 264                            int ownerX, int ownerY, int popupType) {
 265         if (GraphicsEnvironment.isHeadless()) {
 266             return getHeadlessPopup(owner, contents, ownerX, ownerY);
 267         }
 268 
 269         switch(popupType) {
 270         case LIGHT_WEIGHT_POPUP:
 271             return getLightWeightPopup(owner, contents, ownerX, ownerY);
 272         case MEDIUM_WEIGHT_POPUP:
 273             return getMediumWeightPopup(owner, contents, ownerX, ownerY);
 274         case HEAVY_WEIGHT_POPUP:
 275             Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
 276             if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
 277                 OSInfo.OSType.MACOSX) && (owner != null) &&
 278                 (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
 279                 ((HeavyWeightPopup)popup).setCacheEnabled(false);
 280             }
 281             return popup;
 282         }




 243         // correctly.
 244         Component c = owner;
 245         while (c != null) {
 246             if (c instanceof JComponent) {
 247                 if (((JComponent)c).getClientProperty(
 248                             PopupFactory_FORCE_HEAVYWEIGHT_POPUP) == Boolean.TRUE) {
 249                     popupType = HEAVY_WEIGHT_POPUP;
 250                     break;
 251                 }
 252             }
 253             c = c.getParent();
 254         }
 255 
 256         return popupType;
 257     }
 258 
 259     /**
 260      * Obtains the appropriate <code>Popup</code> based on
 261      * <code>popupType</code>.
 262      */
 263     @SuppressWarnings("deprecation")
 264     private Popup getPopup(Component owner, Component contents,
 265                            int ownerX, int ownerY, int popupType) {
 266         if (GraphicsEnvironment.isHeadless()) {
 267             return getHeadlessPopup(owner, contents, ownerX, ownerY);
 268         }
 269 
 270         switch(popupType) {
 271         case LIGHT_WEIGHT_POPUP:
 272             return getLightWeightPopup(owner, contents, ownerX, ownerY);
 273         case MEDIUM_WEIGHT_POPUP:
 274             return getMediumWeightPopup(owner, contents, ownerX, ownerY);
 275         case HEAVY_WEIGHT_POPUP:
 276             Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
 277             if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
 278                 OSInfo.OSType.MACOSX) && (owner != null) &&
 279                 (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
 280                 ((HeavyWeightPopup)popup).setCacheEnabled(false);
 281             }
 282             return popup;
 283         }


< prev index next >