On Tue, 17 Feb 2026 11:43:12 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> I dont think we can align normal JMenuItem icon location with 
> JRadioButtonMenuItem/JCheckBoxMenuItem icon location.
> The latter needs a two column layout while normal JMenuItem as in this case 
> needs 1 column as was asked in this JBS so the icon is left aligned for 
> normal JMenuItem so it's expected change as far I am concerned.

Why can't we?

Both Metal and Nimbus perfect align them. See [the 
screenshots](https://github.com/openjdk/jdk/pull/23324#issuecomment-3008593168) 
I posted in #23324 for 
[JDK-8348760](https://bugs.openjdk.org/browse/JDK-8348760).
![JMenu layout with radio bullets, check marks and icons in Metal 
Look-and-Feel](https://github.com/user-attachments/assets/65c5b4bb-dc3b-46dd-a74a-2cb6ef53ccc9)

Why can't Windows L&F?

The entire popup menu has to have a consistent layout, and that layout should 
be performed by `DefaultMenuLayout` and `MenuItemLayoutHelper` with minimal 
(preferably no tweaks) from the menu item UI itself.

At this time, Windows L&F implementation does *too much tweaking*, which comes 
from how icons were implemented in Windows L&F, specifically the check mark or 
bullet were hidden if a `JCheckBoxMenuItem` or `JRadioButtonMenuItem` had an 
icon. After JDK-8348760, the check mark or bullet and the icon are two separate 
entities that have to be handled separately.

This is why `VistaMenuItemCheckIcon` needs revising and likely dropping 
altogether. [I said it 
already](https://github.com/openjdk/jdk/pull/28889#discussion_r2694197701) in 
#28889:

> Is it because Windows icons used to be special and combined the icon and 
> check mark / bullet mark, or rather replaced the check mark / bullet mark 
> with the icon? Should we get rid of that special treatment?
>
> … Both Metal and Nimbus L&F have similar column layouts where a separate 
> column is allocated for marks and icons, Windows L&F should re-use that code.

And now it comes up again.

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

PR Comment: https://git.openjdk.org/jdk/pull/29730#issuecomment-3914455950

Reply via email to