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

Print this page




 488         if (gc.getDevice().getType() !=
 489             GraphicsDevice.TYPE_RASTER_SCREEN) {
 490             throw new IllegalArgumentException("not a screen device");
 491         }
 492         setLayout(new BorderLayout());
 493 
 494         /* offset the initial location with the original of the screen */
 495         /* and any insets                                              */
 496         Rectangle screenBounds = gc.getBounds();
 497         Insets screenInsets = getToolkit().getScreenInsets(gc);
 498         int x = getX() + screenBounds.x + screenInsets.left;
 499         int y = getY() + screenBounds.y + screenInsets.top;
 500         if (x != this.x || y != this.y) {
 501             setLocation(x, y);
 502             /* reset after setLocation */
 503             setLocationByPlatform(locationByPlatformProp);
 504         }
 505 
 506         modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
 507 
 508         SunToolkit.checkAndSetPolicy(this, false);
 509     }
 510 
 511     /**
 512      * Constructs a new, initially invisible window in the default size.
 513      *
 514      * <p>First, if there is a security manager, its
 515      * <code>checkTopLevelWindow</code>
 516      * method is called with <code>this</code>
 517      * as its argument
 518      * to see if it's ok to display the window without a warning banner.
 519      * If the default implementation of <code>checkTopLevelWindow</code>
 520      * is used (that is, that method is not overriden), then this results in
 521      * a call to the security manager's <code>checkPermission</code> method
 522      * with an <code>AWTPermission("showWindowWithoutWarningBanner")</code>
 523      * permission. It that method raises a SecurityException,
 524      * <code>checkTopLevelWindow</code> returns false, otherwise it
 525      * returns true. If it returns false, a warning banner is created.
 526      *
 527      * @exception HeadlessException when
 528      *     <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>




 488         if (gc.getDevice().getType() !=
 489             GraphicsDevice.TYPE_RASTER_SCREEN) {
 490             throw new IllegalArgumentException("not a screen device");
 491         }
 492         setLayout(new BorderLayout());
 493 
 494         /* offset the initial location with the original of the screen */
 495         /* and any insets                                              */
 496         Rectangle screenBounds = gc.getBounds();
 497         Insets screenInsets = getToolkit().getScreenInsets(gc);
 498         int x = getX() + screenBounds.x + screenInsets.left;
 499         int y = getY() + screenBounds.y + screenInsets.top;
 500         if (x != this.x || y != this.y) {
 501             setLocation(x, y);
 502             /* reset after setLocation */
 503             setLocationByPlatform(locationByPlatformProp);
 504         }
 505 
 506         modalExclusionType = Dialog.ModalExclusionType.NO_EXCLUDE;
 507 
 508         SunToolkit.checkAndSetPolicy(this);
 509     }
 510 
 511     /**
 512      * Constructs a new, initially invisible window in the default size.
 513      *
 514      * <p>First, if there is a security manager, its
 515      * <code>checkTopLevelWindow</code>
 516      * method is called with <code>this</code>
 517      * as its argument
 518      * to see if it's ok to display the window without a warning banner.
 519      * If the default implementation of <code>checkTopLevelWindow</code>
 520      * is used (that is, that method is not overriden), then this results in
 521      * a call to the security manager's <code>checkPermission</code> method
 522      * with an <code>AWTPermission("showWindowWithoutWarningBanner")</code>
 523      * permission. It that method raises a SecurityException,
 524      * <code>checkTopLevelWindow</code> returns false, otherwise it
 525      * returns true. If it returns false, a warning banner is created.
 526      *
 527      * @exception HeadlessException when
 528      *     <code>GraphicsEnvironment.isHeadless()</code> returns <code>true</code>