RFR: 6223700: XP L&F: Non-TopLevel JMenu's painting error
Damon Nguyen
dnguyen at openjdk.org
Mon Dec 8 17:20:03 UTC 2025
On Fri, 28 Nov 2025 08:50:09 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> 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`
Marked as reviewed by dnguyen (Committer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/28551#pullrequestreview-3553161804
More information about the client-libs-dev
mailing list