jdk/src/share/classes/java/awt/Component.java
changeset 12651 8c69dd24bf07
parent 12643 5d709010bb1d
child 12666 0799075de9d6
equal deleted inserted replaced
12650:0006acd3a5fa 12651:8c69dd24bf07
  7831         }
  7831         }
  7832         if (clearOnFailure && !res) {
  7832         if (clearOnFailure && !res) {
  7833             if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7833             if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7834                 focusLog.finer("clear global focus owner");
  7834                 focusLog.finer("clear global focus owner");
  7835             }
  7835             }
  7836             KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
  7836             KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwnerPriv();
  7837         }
  7837         }
  7838         if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7838         if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7839             focusLog.finer("returning result: " + res);
  7839             focusLog.finer("returning result: " + res);
  7840         }
  7840         }
  7841         return res;
  7841         return res;
  7912         }
  7912         }
  7913         if (clearOnFailure && !res) {
  7913         if (clearOnFailure && !res) {
  7914             if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7914             if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7915                 focusLog.finer("clear global focus owner");
  7915                 focusLog.finer("clear global focus owner");
  7916             }
  7916             }
  7917             KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
  7917             KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwnerPriv();
  7918         }
  7918         }
  7919         if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7919         if (focusLog.isLoggable(PlatformLogger.FINER)) {
  7920             focusLog.finer("returning result: " + res);
  7920             focusLog.finer("returning result: " + res);
  7921         }
  7921         }
  7922         return res;
  7922         return res;
  7945         }
  7945         }
  7946 
  7946 
  7947         if (rootAncestor != null) {
  7947         if (rootAncestor != null) {
  7948             Container rootAncestorRootAncestor =
  7948             Container rootAncestorRootAncestor =
  7949                 rootAncestor.getFocusCycleRootAncestor();
  7949                 rootAncestor.getFocusCycleRootAncestor();
  7950             KeyboardFocusManager.getCurrentKeyboardFocusManager().
  7950 
  7951                 setGlobalCurrentFocusCycleRoot(
  7951             final Container fcr = (rootAncestorRootAncestor != null) ?
  7952                                                (rootAncestorRootAncestor != null)
  7952                 rootAncestorRootAncestor : rootAncestor;
  7953                                                ? rootAncestorRootAncestor
  7953 
  7954                                                : rootAncestor);
  7954             AccessController.doPrivileged(new PrivilegedAction() {
       
  7955                 public Object run() {
       
  7956                     KeyboardFocusManager.getCurrentKeyboardFocusManager().
       
  7957                         setGlobalCurrentFocusCycleRoot(fcr);
       
  7958                     return null;
       
  7959                 }
       
  7960             });
  7955             rootAncestor.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP);
  7961             rootAncestor.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP);
  7956         } else {
  7962         } else {
  7957             Window window = getContainingWindow();
  7963             final Window window = getContainingWindow();
  7958 
  7964 
  7959             if (window != null) {
  7965             if (window != null) {
  7960                 Component toFocus = window.getFocusTraversalPolicy().
  7966                 Component toFocus = window.getFocusTraversalPolicy().
  7961                     getDefaultComponent(window);
  7967                     getDefaultComponent(window);
  7962                 if (toFocus != null) {
  7968                 if (toFocus != null) {
  7963                     KeyboardFocusManager.getCurrentKeyboardFocusManager().
  7969                     AccessController.doPrivileged(new PrivilegedAction() {
  7964                         setGlobalCurrentFocusCycleRoot(window);
  7970                         public Object run() {
       
  7971                             KeyboardFocusManager.getCurrentKeyboardFocusManager().
       
  7972                                 setGlobalCurrentFocusCycleRoot(window);
       
  7973                             return null;
       
  7974                         }
       
  7975                     });
  7965                     toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP);
  7976                     toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP);
  7966                 }
  7977                 }
  7967             }
  7978             }
  7968         }
  7979         }
  7969     }
  7980     }