On Fri, 20 Jun 2025 03:09:32 GMT, Prasanta Sadhukhan <psadhuk...@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..

One more thing I observed is "If we change the order of menu creation" then the 
icons rendered are different.
For e.g. if the order is

    menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel",
                "Metal"));
        
menuBar.add(createMenu("com.sun.java.swing.plaf.windows.WindowsLookAndFeel",
                "Windows"));
        menuBar.add(createMenu("com.sun.java.swing.plaf.motif.MotifLookAndFeel",
                "Motif"));

then the icons are 
![Windows_Second_Pos](https://github.com/user-attachments/assets/81efec22-b3b2-48e2-a31b-f095c8ec4c3f)

and when Windows L&F is at last pos then rendered icons are
![Windows_Last_Pos](https://github.com/user-attachments/assets/6b13bfb8-c319-4344-afd7-26584f3a2056)

Shouldn't the icons for the L&Fs be same ?

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

PR Comment: https://git.openjdk.org/jdk/pull/25907#issuecomment-3034978507

Reply via email to