jdk Sdiff src/share/classes/java/awt (original) (raw)


2846 * 2847 * The native container of the LW component has this field set 2848 * to tell it that it should block Mouse events for all LW 2849 * children except for the modal component. 2850 * 2851 * In the case of nested Modal components, we store the previous 2852 * modal component in the new modal components value of modalComp; 2853 */ 2854 2855 transient Component modalComp; 2856 transient AppContext modalAppContext; 2857 2858 private void startLWModal() { 2859 // Store the app context on which this component is being shown. 2860 // Event dispatch thread of this app context will be sleeping until 2861 // we wake it by any event from hideAndDisposeHandler(). 2862 modalAppContext = AppContext.getAppContext(); 2863 2864 // keep the KeyEvents from being dispatched 2865 // until the focus has been transfered 2866 long time = Toolkit.getEventQueue().getMostRecentEventTime(); 2867 Component predictedFocusOwner = (Component.isInstanceOf(this, "javax.swing.JInternalFrame")) ? ((javax.swing.JInternalFrame)(this)).getMostRecentFocusOwner() : null; 2868 if (predictedFocusOwner != null) { 2869 KeyboardFocusManager.getCurrentKeyboardFocusManager(). 2870 enqueueKeyEvents(time, predictedFocusOwner); 2871 } 2872 // We have two mechanisms for blocking: 1. If we're on the 2873 // EventDispatchThread, start a new event pump. 2. If we're 2874 // on any other thread, call wait() on the treelock. 2875 final Container nativeContainer; 2876 synchronized (getTreeLock()) { 2877 nativeContainer = getHeavyweightContainer(); 2878 if (nativeContainer.modalComp != null) { 2879 this.modalComp = nativeContainer.modalComp; 2880 nativeContainer.modalComp = this; 2881 return; 2882 } 2883 else { 2884 nativeContainer.modalComp = this; 2885 } 2886 }



2846 * 2847 * The native container of the LW component has this field set 2848 * to tell it that it should block Mouse events for all LW 2849 * children except for the modal component. 2850 * 2851 * In the case of nested Modal components, we store the previous 2852 * modal component in the new modal components value of modalComp; 2853 */ 2854 2855 transient Component modalComp; 2856 transient AppContext modalAppContext; 2857 2858 private void startLWModal() { 2859 // Store the app context on which this component is being shown. 2860 // Event dispatch thread of this app context will be sleeping until 2861 // we wake it by any event from hideAndDisposeHandler(). 2862 modalAppContext = AppContext.getAppContext(); 2863 2864 // keep the KeyEvents from being dispatched 2865 // until the focus has been transfered 2866 long time = Toolkit.getEventQueue().getMostRecentKeyEventTime(); 2867 Component predictedFocusOwner = (Component.isInstanceOf(this, "javax.swing.JInternalFrame")) ? ((javax.swing.JInternalFrame)(this)).getMostRecentFocusOwner() : null; 2868 if (predictedFocusOwner != null) { 2869 KeyboardFocusManager.getCurrentKeyboardFocusManager(). 2870 enqueueKeyEvents(time, predictedFocusOwner); 2871 } 2872 // We have two mechanisms for blocking: 1. If we're on the 2873 // EventDispatchThread, start a new event pump. 2. If we're 2874 // on any other thread, call wait() on the treelock. 2875 final Container nativeContainer; 2876 synchronized (getTreeLock()) { 2877 nativeContainer = getHeavyweightContainer(); 2878 if (nativeContainer.modalComp != null) { 2879 this.modalComp = nativeContainer.modalComp; 2880 nativeContainer.modalComp = this; 2881 return; 2882 } 2883 else { 2884 nativeContainer.modalComp = this; 2885 } 2886 }