src/share/classes/java/awt/Window.java

Print this page




1005      * @see       Component#isDisplayable
1006      * @see       #toFront
1007      * @deprecated As of JDK version 1.5, replaced by
1008      * {@link #setVisible(boolean)}.
1009      */
1010     @Deprecated
1011     public void show() {
1012         if (peer == null) {
1013             addNotify();
1014         }
1015         validateUnconditionally();
1016 
1017         isInShow = true;
1018         if (visible) {
1019             toFront();
1020         } else {
1021             beforeFirstShow = false;
1022             closeSplashScreen();
1023             Dialog.checkShouldBeBlocked(this);
1024             super.show();
1025             locationByPlatform = false;
1026             for (int i = 0; i < ownedWindowList.size(); i++) {
1027                 Window child = ownedWindowList.elementAt(i).get();
1028                 if ((child != null) && child.showWithParent) {
1029                     child.show();
1030                     child.showWithParent = false;
1031                 }       // endif
1032             }   // endfor
1033             if (!isModalBlocked()) {
1034                 updateChildrenBlocking();
1035             } else {
1036                 // fix for 6532736: after this window is shown, its blocker
1037                 // should be raised to front
1038                 modalBlocker.toFront_NoClientCode();
1039             }
1040             if (this instanceof Frame || this instanceof Dialog) {
1041                 updateChildFocusableWindowState(this);
1042             }
1043         }
1044         isInShow = false;
1045 


1078      * @see #show
1079      * @see #dispose
1080      * @deprecated As of JDK version 1.5, replaced by
1081      * {@link #setVisible(boolean)}.
1082      */
1083     @Deprecated
1084     public void hide() {
1085         synchronized(ownedWindowList) {
1086             for (int i = 0; i < ownedWindowList.size(); i++) {
1087                 Window child = ownedWindowList.elementAt(i).get();
1088                 if ((child != null) && child.visible) {
1089                     child.hide();
1090                     child.showWithParent = true;
1091                 }
1092             }
1093         }
1094         if (isModalBlocked()) {
1095             modalBlocker.unblockWindow(this);
1096         }
1097         super.hide();

1098     }
1099 
1100     final void clearMostRecentFocusOwnerOnHide() {
1101         /* do nothing */
1102     }
1103 
1104     /**
1105      * Releases all of the native screen resources used by this
1106      * {@code Window}, its subcomponents, and all of its owned
1107      * children. That is, the resources for these {@code Component}s
1108      * will be destroyed, any memory they consume will be returned to the
1109      * OS, and they will be marked as undisplayable.
1110      * <p>
1111      * The {@code Window} and its subcomponents can be made displayable
1112      * again by rebuilding the native resources with a subsequent call to
1113      * {@code pack} or {@code show}. The states of the recreated
1114      * {@code Window} and its subcomponents will be identical to the
1115      * states of these objects at the point where the {@code Window}
1116      * was disposed (not accounting for additional modifications between
1117      * those actions).


3017      * Unrecognized keys or values will be ignored.
3018      *
3019      * @param s the {@code ObjectInputStream} to read
3020      * @exception HeadlessException if
3021      *   {@code GraphicsEnvironment.isHeadless} returns
3022      *   {@code true}
3023      * @see java.awt.GraphicsEnvironment#isHeadless
3024      * @see #writeObject
3025      */
3026     private void readObject(ObjectInputStream s)
3027       throws ClassNotFoundException, IOException, HeadlessException
3028     {
3029          GraphicsEnvironment.checkHeadless();
3030          initDeserializedWindow();
3031          ObjectInputStream.GetField f = s.readFields();
3032 
3033          syncLWRequests = f.get("syncLWRequests", systemSyncLWRequests);
3034          state = f.get("state", 0);
3035          focusableWindowState = f.get("focusableWindowState", true);
3036          windowSerializedDataVersion = f.get("windowSerializedDataVersion", 1);
3037          locationByPlatform = f.get("locationByPlatform", locationByPlatformProp);
3038          // Note: 1.4 (or later) doesn't use focusMgr
3039          focusMgr = (FocusManager)f.get("focusMgr", null);
3040          Dialog.ModalExclusionType et = (Dialog.ModalExclusionType)
3041              f.get("modalExclusionType", Dialog.ModalExclusionType.NO_EXCLUDE);
3042          setModalExclusionType(et); // since 6.0
3043          boolean aot = f.get("alwaysOnTop", false);
3044          if(aot) {
3045              setAlwaysOnTop(aot); // since 1.5; subject to permission check
3046          }
3047          shape = (Shape)f.get("shape", null);
3048          opacity = (Float)f.get("opacity", 1.0f);
3049 
3050          this.securityWarningWidth = 0;
3051          this.securityWarningHeight = 0;
3052          this.securityWarningPointX = 2.0;
3053          this.securityWarningPointY = 0.0;
3054          this.securityWarningAlignmentX = RIGHT_ALIGNMENT;
3055          this.securityWarningAlignmentY = TOP_ALIGNMENT;
3056 
3057          deserializeResources(s);




1005      * @see       Component#isDisplayable
1006      * @see       #toFront
1007      * @deprecated As of JDK version 1.5, replaced by
1008      * {@link #setVisible(boolean)}.
1009      */
1010     @Deprecated
1011     public void show() {
1012         if (peer == null) {
1013             addNotify();
1014         }
1015         validateUnconditionally();
1016 
1017         isInShow = true;
1018         if (visible) {
1019             toFront();
1020         } else {
1021             beforeFirstShow = false;
1022             closeSplashScreen();
1023             Dialog.checkShouldBeBlocked(this);
1024             super.show();
1025             setLocationByPlatform(false);
1026             for (int i = 0; i < ownedWindowList.size(); i++) {
1027                 Window child = ownedWindowList.elementAt(i).get();
1028                 if ((child != null) && child.showWithParent) {
1029                     child.show();
1030                     child.showWithParent = false;
1031                 }       // endif
1032             }   // endfor
1033             if (!isModalBlocked()) {
1034                 updateChildrenBlocking();
1035             } else {
1036                 // fix for 6532736: after this window is shown, its blocker
1037                 // should be raised to front
1038                 modalBlocker.toFront_NoClientCode();
1039             }
1040             if (this instanceof Frame || this instanceof Dialog) {
1041                 updateChildFocusableWindowState(this);
1042             }
1043         }
1044         isInShow = false;
1045 


1078      * @see #show
1079      * @see #dispose
1080      * @deprecated As of JDK version 1.5, replaced by
1081      * {@link #setVisible(boolean)}.
1082      */
1083     @Deprecated
1084     public void hide() {
1085         synchronized(ownedWindowList) {
1086             for (int i = 0; i < ownedWindowList.size(); i++) {
1087                 Window child = ownedWindowList.elementAt(i).get();
1088                 if ((child != null) && child.visible) {
1089                     child.hide();
1090                     child.showWithParent = true;
1091                 }
1092             }
1093         }
1094         if (isModalBlocked()) {
1095             modalBlocker.unblockWindow(this);
1096         }
1097         super.hide();
1098         setLocationByPlatform(false);
1099     }
1100 
1101     final void clearMostRecentFocusOwnerOnHide() {
1102         /* do nothing */
1103     }
1104 
1105     /**
1106      * Releases all of the native screen resources used by this
1107      * {@code Window}, its subcomponents, and all of its owned
1108      * children. That is, the resources for these {@code Component}s
1109      * will be destroyed, any memory they consume will be returned to the
1110      * OS, and they will be marked as undisplayable.
1111      * <p>
1112      * The {@code Window} and its subcomponents can be made displayable
1113      * again by rebuilding the native resources with a subsequent call to
1114      * {@code pack} or {@code show}. The states of the recreated
1115      * {@code Window} and its subcomponents will be identical to the
1116      * states of these objects at the point where the {@code Window}
1117      * was disposed (not accounting for additional modifications between
1118      * those actions).


3018      * Unrecognized keys or values will be ignored.
3019      *
3020      * @param s the {@code ObjectInputStream} to read
3021      * @exception HeadlessException if
3022      *   {@code GraphicsEnvironment.isHeadless} returns
3023      *   {@code true}
3024      * @see java.awt.GraphicsEnvironment#isHeadless
3025      * @see #writeObject
3026      */
3027     private void readObject(ObjectInputStream s)
3028       throws ClassNotFoundException, IOException, HeadlessException
3029     {
3030          GraphicsEnvironment.checkHeadless();
3031          initDeserializedWindow();
3032          ObjectInputStream.GetField f = s.readFields();
3033 
3034          syncLWRequests = f.get("syncLWRequests", systemSyncLWRequests);
3035          state = f.get("state", 0);
3036          focusableWindowState = f.get("focusableWindowState", true);
3037          windowSerializedDataVersion = f.get("windowSerializedDataVersion", 1);
3038          setLocationByPlatform(f.get("locationByPlatform", locationByPlatformProp));
3039          // Note: 1.4 (or later) doesn't use focusMgr
3040          focusMgr = (FocusManager)f.get("focusMgr", null);
3041          Dialog.ModalExclusionType et = (Dialog.ModalExclusionType)
3042              f.get("modalExclusionType", Dialog.ModalExclusionType.NO_EXCLUDE);
3043          setModalExclusionType(et); // since 6.0
3044          boolean aot = f.get("alwaysOnTop", false);
3045          if(aot) {
3046              setAlwaysOnTop(aot); // since 1.5; subject to permission check
3047          }
3048          shape = (Shape)f.get("shape", null);
3049          opacity = (Float)f.get("opacity", 1.0f);
3050 
3051          this.securityWarningWidth = 0;
3052          this.securityWarningHeight = 0;
3053          this.securityWarningPointX = 2.0;
3054          this.securityWarningPointY = 0.0;
3055          this.securityWarningAlignmentX = RIGHT_ALIGNMENT;
3056          this.securityWarningAlignmentY = TOP_ALIGNMENT;
3057 
3058          deserializeResources(s);