src/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page




 298             f = DEFAULT_FONT;
 299         }
 300         return platformWindow.transformGraphics(new SunGraphics2D(getSurfaceData(), fg, bg, f));
 301     }
 302 
 303     @Override
 304     public void setBounds(int x, int y, int w, int h, int op) {
 305 
 306         if((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) {
 307             return;
 308         }
 309 
 310         if ((op & SET_CLIENT_SIZE) != 0) {
 311             // SET_CLIENT_SIZE is only applicable to window peers, so handle it here
 312             // instead of pulling 'insets' field up to LWComponentPeer
 313             // no need to add insets since Window's notion of width and height includes insets.
 314             op &= ~SET_CLIENT_SIZE;
 315             op |= SET_SIZE;
 316         }
 317 















 318         if (w < MINIMUM_WIDTH) {
 319             w = MINIMUM_WIDTH;
 320         }

 321         if (h < MINIMUM_HEIGHT) {
 322             h = MINIMUM_HEIGHT;
 323         }
 324 
 325         final int maxW = getLWGC().getMaxTextureWidth();
 326         final int maxH = getLWGC().getMaxTextureHeight();
 327 
 328         if (w > maxW) {
 329             w = maxW;
 330         }
 331         if (h > maxH) {
 332             h = maxH;
 333         }
 334 
 335         // Don't post ComponentMoved/Resized and Paint events
 336         // until we've got a notification from the delegate
 337         setBounds(x, y, w, h, op, false, false);
 338         // Get updated bounds, so we don't have to handle 'op' here manually
 339         Rectangle r = getBounds();
 340         platformWindow.setBounds(r.x, r.y, r.width, r.height);
 341     }
 342 
 343     @Override
 344     public Point getLocationOnScreen() {
 345         return platformWindow.getLocationOnScreen();
 346     }
 347 
 348     /**
 349      * Overridden from LWContainerPeer to return the correct insets.
 350      * Insets are queried from the delegate and are kept up to date by
 351      * requiering when needed (i.e. when the window geometry is changed).
 352      */
 353     @Override
 354     public Insets getInsets() {
 355         synchronized (getStateLock()) {
 356             return insets;
 357         }
 358     }
 359 
 360     @Override




 298             f = DEFAULT_FONT;
 299         }
 300         return platformWindow.transformGraphics(new SunGraphics2D(getSurfaceData(), fg, bg, f));
 301     }
 302 
 303     @Override
 304     public void setBounds(int x, int y, int w, int h, int op) {
 305 
 306         if((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) {
 307             return;
 308         }
 309 
 310         if ((op & SET_CLIENT_SIZE) != 0) {
 311             // SET_CLIENT_SIZE is only applicable to window peers, so handle it here
 312             // instead of pulling 'insets' field up to LWComponentPeer
 313             // no need to add insets since Window's notion of width and height includes insets.
 314             op &= ~SET_CLIENT_SIZE;
 315             op |= SET_SIZE;
 316         }
 317 
 318         // Don't post ComponentMoved/Resized and Paint events
 319         // until we've got a notification from the delegate
 320         Rectangle cb = getCheckedBounds(x, y, w, h);        
 321         setBounds(cb.x, cb.y, cb.width, cb.height, op, false, false);
 322         // Get updated bounds, so we don't have to handle 'op' here manually
 323         Rectangle r = getBounds();
 324         platformWindow.setBounds(r.x, r.y, r.width, r.height);
 325     }
 326     
 327     public Rectangle getCheckedBounds(Rectangle bounds) {
 328         return getCheckedBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 329     }
 330 
 331     public Rectangle getCheckedBounds(int x, int y, int w, int h) {
 332 
 333         if (w < MINIMUM_WIDTH) {
 334             w = MINIMUM_WIDTH;
 335         }
 336         
 337         if (h < MINIMUM_HEIGHT) {
 338             h = MINIMUM_HEIGHT;
 339         }
 340 
 341         final int maxW = getLWGC().getMaxTextureWidth();
 342         final int maxH = getLWGC().getMaxTextureHeight();
 343 
 344         if (w > maxW) {
 345             w = maxW;
 346         }
 347         if (h > maxH) {
 348             h = maxH;
 349         }
 350         
 351         return new Rectangle(x, y, w, h);





 352     }
 353 
 354     @Override
 355     public Point getLocationOnScreen() {
 356         return platformWindow.getLocationOnScreen();
 357     }
 358 
 359     /**
 360      * Overridden from LWContainerPeer to return the correct insets.
 361      * Insets are queried from the delegate and are kept up to date by
 362      * requiering when needed (i.e. when the window geometry is changed).
 363      */
 364     @Override
 365     public Insets getInsets() {
 366         synchronized (getStateLock()) {
 367             return insets;
 368         }
 369     }
 370 
 371     @Override