From e908362f0af52aefdd8f22d4c27157b216fb4f15 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 20 Jun 2023 23:15:11 +0200 Subject: [PATCH] fixed `IllegalComponentStateException` when invoker is not showing in `SubMenuUsabilityHelper` (issue #692) --- CHANGELOG.md | 8 ++++++++ .../java/com/formdev/flatlaf/SubMenuUsabilityHelper.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c340de32..83635419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ FlatLaf Change Log ================== +## 3.2-SNAPSHOT + +#### Fixed bugs + +- Fixed `IllegalComponentStateException` when invoker is not showing in + `SubMenuUsabilityHelper`. (issue #692) + + ## 3.1.1 - IntelliJ Themes: diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/SubMenuUsabilityHelper.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/SubMenuUsabilityHelper.java index 8d2a1b37..7c848694 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/SubMenuUsabilityHelper.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/SubMenuUsabilityHelper.java @@ -153,7 +153,7 @@ debug*/ // get invoker screen bounds Component invoker = popup.getInvoker(); - invokerBounds = (invoker != null) + invokerBounds = (invoker != null && invoker.isShowing()) ? new Rectangle( invoker.getLocationOnScreen(), invoker.getSize() ) : null;