365 366 final boolean isFrame = (target instanceof Frame); 367 final boolean isDialog = (target instanceof Dialog); 368 final boolean isPopup = (target.getType() == Window.Type.POPUP); 369 if (isDialog) { 370 styleBits = SET(styleBits, MINIMIZABLE, false); 371 } 372 373 // Either java.awt.Frame or java.awt.Dialog can be undecorated, however java.awt.Window always is undecorated. 374 { 375 this.undecorated = isFrame ? ((Frame)target).isUndecorated() : (isDialog ? ((Dialog)target).isUndecorated() : true); 376 if (this.undecorated) styleBits = SET(styleBits, DECORATED, false); 377 } 378 379 // Either java.awt.Frame or java.awt.Dialog can be resizable, however java.awt.Window is never resizable 380 { 381 final boolean resizable = isFrame ? ((Frame)target).isResizable() : (isDialog ? ((Dialog)target).isResizable() : false); 382 styleBits = SET(styleBits, RESIZABLE, resizable); 383 if (!resizable) { 384 styleBits = SET(styleBits, ZOOMABLE, false); 385 } else { 386 setCanFullscreen(true); 387 } 388 } 389 390 if (target.isAlwaysOnTop()) { 391 styleBits = SET(styleBits, ALWAYS_ON_TOP, true); 392 } 393 394 if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) { 395 styleBits = SET(styleBits, MODAL_EXCLUDED, true); 396 } 397 398 // If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look. 399 if (isPopup) { 400 styleBits = SET(styleBits, TEXTURED, false); 401 // Popups in applets don't activate applet's process 402 styleBits = SET(styleBits, NONACTIVATING, true); 403 styleBits = SET(styleBits, IS_POPUP, true); 404 } 405 406 if (Window.Type.UTILITY.equals(target.getType())) { 660 // process the close 661 CWrapper.NSWindow.close(ptr); 662 }); 663 } 664 } else { 665 // otherwise, put it in a proper z-order 666 CPlatformWindow bw 667 = (CPlatformWindow) blocker.getPlatformWindow(); 668 bw.execute(blockerPtr -> { 669 execute(ptr -> { 670 CWrapper.NSWindow.orderWindow(ptr, 671 CWrapper.NSWindow.NSWindowBelow, 672 blockerPtr); 673 }); 674 }); 675 } 676 this.visible = visible; 677 678 // Manage the extended state when showing 679 if (visible) { 680 // Apply the extended state as expected in shared code 681 if (target instanceof Frame) { 682 if (!wasMaximized && isMaximized()) { 683 // setVisible could have changed the native maximized state 684 deliverZoom(true); 685 } else { 686 int frameState = ((Frame)target).getExtendedState(); 687 if ((frameState & Frame.ICONIFIED) != 0) { 688 // Treat all state bit masks with ICONIFIED bit as ICONIFIED state. 689 frameState = Frame.ICONIFIED; 690 } 691 switch (frameState) { 692 case Frame.ICONIFIED: 693 execute(CWrapper.NSWindow::miniaturize); 694 break; 695 case Frame.MAXIMIZED_BOTH: 696 maximize(); 697 break; 698 default: // NORMAL 699 unmaximize(); // in case it was maximized, otherwise this is a no-op | 365 366 final boolean isFrame = (target instanceof Frame); 367 final boolean isDialog = (target instanceof Dialog); 368 final boolean isPopup = (target.getType() == Window.Type.POPUP); 369 if (isDialog) { 370 styleBits = SET(styleBits, MINIMIZABLE, false); 371 } 372 373 // Either java.awt.Frame or java.awt.Dialog can be undecorated, however java.awt.Window always is undecorated. 374 { 375 this.undecorated = isFrame ? ((Frame)target).isUndecorated() : (isDialog ? ((Dialog)target).isUndecorated() : true); 376 if (this.undecorated) styleBits = SET(styleBits, DECORATED, false); 377 } 378 379 // Either java.awt.Frame or java.awt.Dialog can be resizable, however java.awt.Window is never resizable 380 { 381 final boolean resizable = isFrame ? ((Frame)target).isResizable() : (isDialog ? ((Dialog)target).isResizable() : false); 382 styleBits = SET(styleBits, RESIZABLE, resizable); 383 if (!resizable) { 384 styleBits = SET(styleBits, ZOOMABLE, false); 385 } 386 } 387 388 if (target.isAlwaysOnTop()) { 389 styleBits = SET(styleBits, ALWAYS_ON_TOP, true); 390 } 391 392 if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) { 393 styleBits = SET(styleBits, MODAL_EXCLUDED, true); 394 } 395 396 // If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look. 397 if (isPopup) { 398 styleBits = SET(styleBits, TEXTURED, false); 399 // Popups in applets don't activate applet's process 400 styleBits = SET(styleBits, NONACTIVATING, true); 401 styleBits = SET(styleBits, IS_POPUP, true); 402 } 403 404 if (Window.Type.UTILITY.equals(target.getType())) { 658 // process the close 659 CWrapper.NSWindow.close(ptr); 660 }); 661 } 662 } else { 663 // otherwise, put it in a proper z-order 664 CPlatformWindow bw 665 = (CPlatformWindow) blocker.getPlatformWindow(); 666 bw.execute(blockerPtr -> { 667 execute(ptr -> { 668 CWrapper.NSWindow.orderWindow(ptr, 669 CWrapper.NSWindow.NSWindowBelow, 670 blockerPtr); 671 }); 672 }); 673 } 674 this.visible = visible; 675 676 // Manage the extended state when showing 677 if (visible) { 678 /* Frame or Dialog should be set property WINDOW_FULLSCREENABLE to true if the 679 Frame or Dialog is resizable. 680 **/ 681 final boolean resizable = (target instanceof Frame) ? ((Frame)target).isResizable() : 682 ((target instanceof Dialog) ? ((Dialog)target).isResizable() : false); 683 if (resizable) { 684 setCanFullscreen(true); 685 } 686 687 // Apply the extended state as expected in shared code 688 if (target instanceof Frame) { 689 if (!wasMaximized && isMaximized()) { 690 // setVisible could have changed the native maximized state 691 deliverZoom(true); 692 } else { 693 int frameState = ((Frame)target).getExtendedState(); 694 if ((frameState & Frame.ICONIFIED) != 0) { 695 // Treat all state bit masks with ICONIFIED bit as ICONIFIED state. 696 frameState = Frame.ICONIFIED; 697 } 698 switch (frameState) { 699 case Frame.ICONIFIED: 700 execute(CWrapper.NSWindow::miniaturize); 701 break; 702 case Frame.MAXIMIZED_BOTH: 703 maximize(); 704 break; 705 default: // NORMAL 706 unmaximize(); // in case it was maximized, otherwise this is a no-op |