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

Print this page




 155         }
 156 
 157         platformWindow.initialize(target, this, ownerDelegate);
 158 
 159         // Init warning window(for applets)
 160         SecurityWarningWindow warn = null;
 161         if (target.getWarningString() != null) {
 162             // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
 163             // and TrayIcon balloon windows without a warning window.
 164             if (!AWTAccessor.getWindowAccessor().isTrayIconWindow(target)) {
 165                 LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
 166                 warn = toolkit.createSecurityWarning(target, this);
 167             }
 168         }
 169 
 170         warningWindow = warn;
 171     }
 172 
 173     @Override
 174     void initializeImpl() {
 175         super.initializeImpl();







 176 
 177 
 178         if (getTarget() instanceof Frame) {
 179             setTitle(((Frame) getTarget()).getTitle());
 180             setState(((Frame) getTarget()).getExtendedState());
 181         } else if (getTarget() instanceof Dialog) {
 182             setTitle(((Dialog) getTarget()).getTitle());
 183         }
 184 
 185         updateAlwaysOnTopState();
 186         updateMinimumSize();
 187 
 188         final Shape shape = getTarget().getShape();
 189         if (shape != null) {
 190             applyShape(Region.getInstance(shape, null));
 191         }
 192 
 193         final float opacity = getTarget().getOpacity();
 194         if (opacity < 1.0f) {
 195             setOpacity(opacity);


 310             op |= SET_SIZE;
 311         }
 312 
 313         // Don't post ComponentMoved/Resized and Paint events
 314         // until we've got a notification from the delegate
 315         Rectangle cb = constrainBounds(x, y, w, h);
 316 
 317         Rectangle newBounds = new Rectangle(getBounds());
 318         if ((op & (SET_LOCATION | SET_BOUNDS)) != 0) {
 319             newBounds.x = cb.x;
 320             newBounds.y = cb.y;
 321         }
 322         if ((op & (SET_SIZE | SET_BOUNDS)) != 0) {
 323             newBounds.width = cb.width;
 324             newBounds.height = cb.height;
 325         }
 326         // Native system could constraint bounds, so the peer wold be updated in the callback
 327         platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
 328     }
 329 






 330     public Rectangle constrainBounds(Rectangle bounds) {
 331         return constrainBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 332     }
 333 
 334     public Rectangle constrainBounds(int x, int y, int w, int h) {
 335 
 336         if (w < MINIMUM_WIDTH) {
 337             w = MINIMUM_WIDTH;
 338         }
 339 
 340         if (h < MINIMUM_HEIGHT) {
 341             h = MINIMUM_HEIGHT;
 342         }
 343 
 344         final int maxW = getLWGC().getMaxTextureWidth();
 345         final int maxH = getLWGC().getMaxTextureHeight();
 346 
 347         if (w > maxW) {
 348             w = maxW;
 349         }




 155         }
 156 
 157         platformWindow.initialize(target, this, ownerDelegate);
 158 
 159         // Init warning window(for applets)
 160         SecurityWarningWindow warn = null;
 161         if (target.getWarningString() != null) {
 162             // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
 163             // and TrayIcon balloon windows without a warning window.
 164             if (!AWTAccessor.getWindowAccessor().isTrayIconWindow(target)) {
 165                 LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
 166                 warn = toolkit.createSecurityWarning(target, this);
 167             }
 168         }
 169 
 170         warningWindow = warn;
 171     }
 172 
 173     @Override
 174     void initializeImpl() {
 175         Window target = getTarget();
 176         setBackground(target.getBackground());
 177         setForeground(target.getForeground());
 178         setFont(target.getFont());
 179         if (!isMaximized() || getTarget().isVisible()) {
 180             setBounds(target.getBounds());
 181         }
 182         setEnabled(target.isEnabled());
 183 
 184 
 185         if (getTarget() instanceof Frame) {
 186             setTitle(((Frame) getTarget()).getTitle());
 187             setState(((Frame) getTarget()).getExtendedState());
 188         } else if (getTarget() instanceof Dialog) {
 189             setTitle(((Dialog) getTarget()).getTitle());
 190         }
 191 
 192         updateAlwaysOnTopState();
 193         updateMinimumSize();
 194 
 195         final Shape shape = getTarget().getShape();
 196         if (shape != null) {
 197             applyShape(Region.getInstance(shape, null));
 198         }
 199 
 200         final float opacity = getTarget().getOpacity();
 201         if (opacity < 1.0f) {
 202             setOpacity(opacity);


 317             op |= SET_SIZE;
 318         }
 319 
 320         // Don't post ComponentMoved/Resized and Paint events
 321         // until we've got a notification from the delegate
 322         Rectangle cb = constrainBounds(x, y, w, h);
 323 
 324         Rectangle newBounds = new Rectangle(getBounds());
 325         if ((op & (SET_LOCATION | SET_BOUNDS)) != 0) {
 326             newBounds.x = cb.x;
 327             newBounds.y = cb.y;
 328         }
 329         if ((op & (SET_SIZE | SET_BOUNDS)) != 0) {
 330             newBounds.width = cb.width;
 331             newBounds.height = cb.height;
 332         }
 333         // Native system could constraint bounds, so the peer wold be updated in the callback
 334         platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
 335     }
 336 
 337     public boolean isMaximized() {
 338         Window win = getTarget();
 339         return win instanceof Frame
 340                 && ((Frame) win).getExtendedState() == Frame.MAXIMIZED_BOTH;
 341     }
 342 
 343     public Rectangle constrainBounds(Rectangle bounds) {
 344         return constrainBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 345     }
 346 
 347     public Rectangle constrainBounds(int x, int y, int w, int h) {
 348 
 349         if (w < MINIMUM_WIDTH) {
 350             w = MINIMUM_WIDTH;
 351         }
 352 
 353         if (h < MINIMUM_HEIGHT) {
 354             h = MINIMUM_HEIGHT;
 355         }
 356 
 357         final int maxW = getLWGC().getMaxTextureWidth();
 358         final int maxH = getLWGC().getMaxTextureHeight();
 359 
 360         if (w > maxW) {
 361             w = maxW;
 362         }