From ff5bd301ccb2b233ace7ccbe5bd220959a1863ea Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 19 Nov 2024 23:25:50 +0100 Subject: [PATCH] Popup: on Windows 10, fixed misplaced popup drop shadow (issue #911; regression in 3.5 since commit a311bac89b786bf6bb57d0e1045d619e0864d414) --- CHANGELOG.md | 2 ++ .../java/com/formdev/flatlaf/ui/FlatPopupFactory.java | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da6680bb4..5ab97f695 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ FlatLaf Change Log factor. (issue #904) - Linux: Fixed continuous cursor toggling between resize and standard cursor when resizing window. (issue #907) +- Popup: On Windows 10, fixed misplaced popup drop shadow. (issue #911; + regression in 3.5) ## 3.5.2 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java index 94e7cda83..bb3621069 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java @@ -695,8 +695,6 @@ void reset( Component contents, int ownerX, int ownerY ) { Container contentPane = ((JWindow)popupWindow).getContentPane(); contentPane.removeAll(); contentPane.add( contents, BorderLayout.CENTER ); - popupWindow.invalidate(); - popupWindow.validate(); popupWindow.pack(); // update client property on contents @@ -957,12 +955,13 @@ void reset( Component contents, int ownerX, int ownerY ) { int w = prefSize.width + insets.left + insets.right; int h = prefSize.height + insets.top + insets.bottom; dropShadowPanel2.setPreferredSize( new Dimension( w, h ) ); + dropShadowPanel2.invalidate(); + dropShadowWindow.pack(); - // update drop shadow popup window location and size + // update drop shadow popup window location int x = popupWindow.getX() - insets.left; int y = popupWindow.getY() - insets.top; - dropShadowWindow.setBounds( x, y, w, h ); - dropShadowWindow.pack(); + dropShadowWindow.setLocation( x, y ); } } }