RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v30]
Alexey Ivanov
aivanov at openjdk.org
Mon Jun 30 13:04:45 UTC 2025
On Mon, 30 Jun 2025 02:13:37 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> No, I didn't.
>>
>> It doesn't work because the overall menu layout isn't right at the moment. If you implement [four-column layout](https://github.com/openjdk/jdk/pull/23324#issuecomment-3008593168): check mark / bullet, icon, text, accelerator, it would work. Just like the text of **MenuItem1** and **JCheckBoxMenuItem 3** would be aligned to the text of other menu items.
>
> Probably you missed seeing it but already _5-column layout_ is implemented via [MenuItemLayoutHelper.layoutMenuItem.](https://github.com/openjdk/jdk/blob/ecd2d83096a1fea7d5086736306770bcffa4fdb6/src/java.desktop/share/classes/sun/swing/MenuItemLayoutHelper.java#L464-L476)
> In the PR. `WindowsMenuItemUI.paintMenuItem` calls `MenuItemLayoutHelper.layoutMenuItem` to layout in 5 columns actually through
> check icon + icon + text + accelerator text + arrow icon layout
> via `paintCheckIcon, paintIcon, paintText, paintAccText and paintArrowIcon` call in `WindowsMenuItemUI.paintMenuItem`
>
> seems like offset value used in WindowsIconFactory paintIcon is not matching with MenuItemLayout expectation and wrong rendering is happening at slightly off position
As I said, I didn't look deeply into the details.
If the menu layout already implements a 5-column layout, this is what I expect because both Metal and Nimbus look exactly like a 5-column layout. Yet Windows L&F is still off, and the margins and offsets don't match what one sees in File Explorer in Windows 11.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2175022017
More information about the client-libs-dev
mailing list