jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java
changeset 26749 b6598aa90114
parent 25859 3317bb8137f4
child 28059 e576535359cc
child 28231 b608ffcaed74
equal deleted inserted replaced
26748:fba66a2e8961 26749:b6598aa90114
  2242             }
  2242             }
  2243             return lightweightRequests.getFirst();
  2243             return lightweightRequests.getFirst();
  2244         }
  2244         }
  2245         public String toString() {
  2245         public String toString() {
  2246             boolean first = true;
  2246             boolean first = true;
  2247             String str = "HeavyweightFocusRequest[heavweight=" + heavyweight +
  2247             String str = "HeavyweightFocusRequest[heavyweight=" + heavyweight +
  2248                 ",lightweightRequests=";
  2248                 ",lightweightRequests=";
  2249             if (lightweightRequests == null) {
  2249             if (lightweightRequests == null) {
  2250                 str += null;
  2250                 str += null;
  2251             } else {
  2251             } else {
  2252                 str += "[";
  2252                 str += "[";
  2664                      * WARNING: This is based on DKFM's logic solely!
  2664                      * WARNING: This is based on DKFM's logic solely!
  2665                      *
  2665                      *
  2666                      * We allow to trigger restoreFocus() in the dispatching process
  2666                      * We allow to trigger restoreFocus() in the dispatching process
  2667                      * only if we have the last request to dispatch. If the last request
  2667                      * only if we have the last request to dispatch. If the last request
  2668                      * fails, focus will be restored to either the component of the last
  2668                      * fails, focus will be restored to either the component of the last
  2669                      * previously succedded request, or to to the focus owner that was
  2669                      * previously succeeded request, or to to the focus owner that was
  2670                      * before this clearing process.
  2670                      * before this clearing process.
  2671                      */
  2671                      */
  2672                     if (!iter.hasNext()) {
  2672                     if (!iter.hasNext()) {
  2673                         disableRestoreFocus = false;
  2673                         disableRestoreFocus = false;
  2674                     }
  2674                     }
  2763                 // if source is equal to first lightweight
  2763                 // if source is equal to first lightweight
  2764                 // then we should correct source and nativeSource
  2764                 // then we should correct source and nativeSource
  2765                 if (source == hwFocusRequest.getFirstLightweightRequest().component)
  2765                 if (source == hwFocusRequest.getFirstLightweightRequest().component)
  2766                 {
  2766                 {
  2767                     source = hwFocusRequest.heavyweight;
  2767                     source = hwFocusRequest.heavyweight;
  2768                     nativeSource = source; // source is heavuweight itself
  2768                     nativeSource = source; // source is heavyweight itself
  2769                 }
  2769                 }
  2770             }
  2770             }
  2771             if (hwFocusRequest != null &&
  2771             if (hwFocusRequest != null &&
  2772                 nativeSource == hwFocusRequest.heavyweight)
  2772                 nativeSource == hwFocusRequest.heavyweight)
  2773             {
  2773             {
  2781 
  2781 
  2782                 Component newSource = lwFocusRequest.component;
  2782                 Component newSource = lwFocusRequest.component;
  2783                 if (currentFocusOwner != null) {
  2783                 if (currentFocusOwner != null) {
  2784                     /*
  2784                     /*
  2785                      * Since we receive FOCUS_GAINED when current focus
  2785                      * Since we receive FOCUS_GAINED when current focus
  2786                      * owner is not null, correcponding FOCUS_LOST is supposed
  2786                      * owner is not null, corresponding FOCUS_LOST is supposed
  2787                      * to be lost.  And so,  we keep new focus owner
  2787                      * to be lost.  And so,  we keep new focus owner
  2788                      * to determine synthetic FOCUS_LOST event which will be
  2788                      * to determine synthetic FOCUS_LOST event which will be
  2789                      * generated by KeyboardFocusManager for this FOCUS_GAINED.
  2789                      * generated by KeyboardFocusManager for this FOCUS_GAINED.
  2790                      *
  2790                      *
  2791                      * This code based on knowledge of
  2791                      * This code based on knowledge of