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

Print this page




 526     @Override
 527     public void setMenuBar(MenuBar mb) {
 528          platformWindow.setMenuBar(mb);
 529     }
 530 
 531     @Override // FramePeer and DialogPeer
 532     public void setResizable(boolean resizable) {
 533         platformWindow.setResizable(resizable);
 534     }
 535 
 536     @Override
 537     public void setState(int state) {
 538         platformWindow.setWindowState(state);
 539     }
 540 
 541     @Override
 542     public int getState() {
 543         return windowState;
 544     }
 545 

















 546     @Override
 547     public void setMaximizedBounds(Rectangle bounds) {
 548         // TODO: not implemented





 549     }
 550 
 551     @Override
 552     public void setBoundsPrivate(int x, int y, int width, int height) {
 553         setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK);
 554     }
 555 
 556     @Override
 557     public Rectangle getBoundsPrivate() {
 558         throw new RuntimeException("not implemented");
 559     }
 560 
 561     // ---- DIALOG PEER METHODS ---- //
 562 
 563     @Override
 564     public void blockWindows(List<Window> windows) {
 565         //TODO: LWX will probably need some collectJavaToplevels to speed this up
 566         for (Window w : windows) {
 567             WindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
 568             if (wp != null) {


1041             graphicsDevice = newGraphicsDevice;
1042         }
1043 
1044         final GraphicsConfiguration newGC = newGraphicsDevice.getDefaultConfiguration();
1045 
1046         if (!setGraphicsConfig(newGC)) return false;
1047 
1048         SunToolkit.executeOnEventHandlerThread(getTarget(), new Runnable() {
1049             public void run() {
1050                 AWTAccessor.getComponentAccessor().setGraphicsConfiguration(getTarget(), newGC);
1051             }
1052         });
1053         return true;
1054     }
1055 
1056     @Override
1057     public final void displayChanged() {
1058         if (updateGraphicsDevice()) {
1059             updateMinimumSize();
1060         }






1061         // Replace surface unconditionally, because internal state of the
1062         // GraphicsDevice could be changed.
1063         replaceSurfaceData();
1064         repaintPeer();
1065     }
1066 
1067     @Override
1068     public final void paletteChanged() {
1069         // components do not need to react to this event.
1070     }
1071 
1072     /*
1073      * May be called by delegate to provide SD to Java2D code.
1074      */
1075     public SurfaceData getSurfaceData() {
1076         synchronized (surfaceDataLock) {
1077             return surfaceData;
1078         }
1079     }
1080 




 526     @Override
 527     public void setMenuBar(MenuBar mb) {
 528          platformWindow.setMenuBar(mb);
 529     }
 530 
 531     @Override // FramePeer and DialogPeer
 532     public void setResizable(boolean resizable) {
 533         platformWindow.setResizable(resizable);
 534     }
 535 
 536     @Override
 537     public void setState(int state) {
 538         platformWindow.setWindowState(state);
 539     }
 540 
 541     @Override
 542     public int getState() {
 543         return windowState;
 544     }
 545 
 546     public Rectangle getMaximizedBounds() {
 547         Object target = getTarget();
 548         return (target instanceof Frame)
 549                 ? ((Frame) target).getMaximizedBounds() : null;
 550     }
 551 
 552     public Rectangle getDefaultMaximizedBounds() {
 553         GraphicsConfiguration config = getGraphicsConfiguration();
 554         Insets insets = ((CGraphicsDevice) config.getDevice()).getScreenInsets();
 555         Rectangle toBounds = config.getBounds();
 556         return new Rectangle(
 557                 toBounds.x + insets.left,
 558                 toBounds.y + insets.top,
 559                 toBounds.width - insets.left - insets.right,
 560                 toBounds.height - insets.top - insets.bottom);
 561     }
 562 
 563     @Override
 564     public void setMaximizedBounds(Rectangle bounds) {
 565 
 566         bounds = (bounds == null)
 567                 ? getDefaultMaximizedBounds()
 568                 : constrainBounds(bounds);
 569         platformWindow.setMaximizedBounds(
 570                 bounds.x, bounds.y, bounds.width, bounds.height);
 571     }
 572 
 573     @Override
 574     public void setBoundsPrivate(int x, int y, int width, int height) {
 575         setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK);
 576     }
 577 
 578     @Override
 579     public Rectangle getBoundsPrivate() {
 580         throw new RuntimeException("not implemented");
 581     }
 582 
 583     // ---- DIALOG PEER METHODS ---- //
 584 
 585     @Override
 586     public void blockWindows(List<Window> windows) {
 587         //TODO: LWX will probably need some collectJavaToplevels to speed this up
 588         for (Window w : windows) {
 589             WindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w);
 590             if (wp != null) {


1063             graphicsDevice = newGraphicsDevice;
1064         }
1065 
1066         final GraphicsConfiguration newGC = newGraphicsDevice.getDefaultConfiguration();
1067 
1068         if (!setGraphicsConfig(newGC)) return false;
1069 
1070         SunToolkit.executeOnEventHandlerThread(getTarget(), new Runnable() {
1071             public void run() {
1072                 AWTAccessor.getComponentAccessor().setGraphicsConfiguration(getTarget(), newGC);
1073             }
1074         });
1075         return true;
1076     }
1077 
1078     @Override
1079     public final void displayChanged() {
1080         if (updateGraphicsDevice()) {
1081             updateMinimumSize();
1082         }
1083 
1084         Rectangle maximizedBounds = getMaximizedBounds();
1085         if (maximizedBounds == null) {
1086             setMaximizedBounds(getDefaultMaximizedBounds());
1087         }
1088 
1089         // Replace surface unconditionally, because internal state of the
1090         // GraphicsDevice could be changed.
1091         replaceSurfaceData();
1092         repaintPeer();
1093     }
1094 
1095     @Override
1096     public final void paletteChanged() {
1097         // components do not need to react to this event.
1098     }
1099 
1100     /*
1101      * May be called by delegate to provide SD to Java2D code.
1102      */
1103     public SurfaceData getSurfaceData() {
1104         synchronized (surfaceDataLock) {
1105             return surfaceData;
1106         }
1107     }
1108