On Tue, 31 Mar 2026 02:07:25 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> > Are we still reserving space for the case where no items have check marks ?
> 
> No, the icon are left aligned if there is no radiobullet/checkmark
> 
> > Is text always aligned in every single case ?
> 
> Text is aligned in the current PR..Only change is the icon is aligned to far 
> left without any space if there is no checkmark…

Prasanta has a point here: this is how Win32 renders menu items.

<img width="559" height="144" alt="rbm.c-2nd-unchecked" 
src="https://github.com/user-attachments/assets/cc15fde3-a12b-4269-a538-d9ea3d2aab1a";
 />\
<img width="545" height="144" alt="rbm.c-2nd-checked" 
src="https://github.com/user-attachments/assets/82d7d165-566c-448e-9c23-b3ad93559a83";
 />

The screenshots above are from `rbm.c` attached to 
[JDK-8348760](https://bugs.openjdk.org/browse/JDK-8348760). The second item is 
the one to look at (it's highlighted, but it's too subtle to notice).

The first screenshot corresponds the state where there's no check-mark; the 
second screenshot has a green square on the left of the blue one, the green 
square is the check-mark image.

> … but I guess it was commented as "weird" and some people expects to align 
> with other icon vertically (in which case there would not be any need of this 
> PR as presently it aligns icon but it leaves space even when there is no 
> checkmark)

Not quite… The comments referred to the following bullet point in [Phil's 
comment 
above](https://github.com/openjdk/jdk/pull/29730#issuecomment-4274379752):

> if no item has both an image and check/radio, but some items have one of 
> these, they share a column (I think that was what we agreed in the original 
> long running PR)

The test from JDK-8348760 should continue to render how it renders now because 
there are menu items that have both the check mark or bullet and an icon.

What should change is that there should be no reserved space for the check mark 
or bullet if no menu item has both. In this case, the check mark or bullet, or 
the icon should be rendered in the same column the space for which is always 
reserved.

In other words, menus where no `JCheckBoxMenuItem` or `JRadioButtonMenuItem` 
have an icon should render the same way they had rendered before JDK-8348760 
was integrated.

<img width="1186" height="464" alt="MenuLookDemo.java in 11.0.29+6 vs 
11.0.29+7" 
src="https://github.com/user-attachments/assets/658263f9-6280-46bc-93f2-e718909be724";
 />

(This is `11ComparisonScreenshot.png` attached to this bug report: 
[JDK-8370945](https://bugs.openjdk.org/browse/JDK-8370945).)

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

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

Reply via email to