RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus LookAndFeel

Alexey Ivanov aivanov at openjdk.org
Tue Jun 24 12:42:33 UTC 2025


On Fri, 20 Jun 2025 03:09:32 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is not displayed in WindowsL&F when the test is run with NimbusL&F.
> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be drawn. This is because the test after setting WIndows L&F of the menuitem reverts back the Windows L&F to Nimbus L&F via `UIManager.setLookAndFeel(save);` call in the test so when frame is made visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
> 
> Fix is made to make sure the whole frame is updated to cater to L&F change via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F without reverting back to original L&F..

This is an invalid test. The L&F has to applied to entire component tree after the application changes it. One has not to expect anything to work correctly if the L&F is changed on the fly.

In this test, the L&F is set before menu items are created. Depending on the L&F internals, it may display well or not; for Windows L&F it doesn't.

The test has to be re-written so that a L&F is changed and the entire component tree is updated, at this pointer the tester verifies how menu items look.

Then the L&F can be changed to a next one. Ideally, all the installed L&Fs should be tested.

-------------

Changes requested by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25907#pullrequestreview-2953647827


More information about the client-libs-dev mailing list