On Fri, 28 Nov 2025 08:50:09 GMT, Prasanta Sadhukhan <[email protected]> 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` This pull request has now been integrated. Changeset: c03d445a Author: Prasanta Sadhukhan <[email protected]> URL: https://git.openjdk.org/jdk/commit/c03d445a8ccfced5a59da680c37587f1024f3eca Stats: 83 lines in 2 files changed: 82 ins; 0 del; 1 mod 6223700: XP L&F: Non-TopLevel JMenu's painting error Reviewed-by: kizune, dnguyen ------------- PR: https://git.openjdk.org/jdk/pull/28551
