RFR: 6223700: XP L&F: Non-TopLevel JMenu's painting error
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Nov 28 09:00:20 UTC 2025
It is seen that non-TopLevel JMenu's get repainted when the mouse exits the item. If the popup menu is still visible to the right, repainting the JMenu causes the selection background to be repainted over the top of the popup, even though the popup is supposed to appear above the JMenu.
The problem is caused by the mouse handling code in the protected inner class `WindowsMenuUI.WindowsMouseInputHandler.` The `mouseEntered` and `mouseExited` handlers set the RollOver property and the JMenu gets repainted. However, setting the RollOver property is only necessary for top-level JMenus. Non-TopLevel JMenu menu items such as these get painted by the super class BasicMenuItemUI which uses isSelected() rather than isRollOver() to determine whether the selection background color should be used.
Fix is to use the repainting only for TopLevel Menu in `mouseExited`, the same way it is being done for `mouseEntered`
-------------
Commit messages:
- jcheck
- 6223700: XP L&F: Non-TopLevel JMenu's painting error
Changes: https://git.openjdk.org/jdk/pull/28551/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28551&range=00
Issue: https://bugs.openjdk.org/browse/JDK-6223700
Stats: 83 lines in 2 files changed: 82 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/28551.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28551/head:pull/28551
PR: https://git.openjdk.org/jdk/pull/28551
More information about the client-libs-dev
mailing list