RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v29]
Phil Race
prr at openjdk.org
Mon Aug 11 16:32:27 UTC 2025
On Mon, 30 Jun 2025 02:16:40 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java line 163:
>>
>>> 161: rect.y += insets.top;
>>> 162: rect.width -= (insets.right + rect.x);
>>> 163: rect.height -= (insets.bottom + rect.y);
>>
>> Suggestion:
>>
>> rect.width -= (insets.right + insets.left);
>> rect.height -= (insets.bottom + insets.top);
>>
>> The formula doesn't look right. Why do you subtract `rect.x` and `rect.y` instead of `insets.left` and `insets.top`?
>>
>> This would work correctly if both `rect.x` and `rect.y` are zero, but it would give wrong results in other cases.
>
> It was the same calculation used in `BasicMenuItemUI `which is now moved to `SwingUtilities3 `so that it can be called from Basic and `WindowsMenuItemUI `to avoid code duplication....you can compare the contents before the fix.....in this specific case, `rect.x` is inclusive of `insets.left`..
>
> Similarly other SwingUtilities3 changes are also as it was in BasicMenuItemUI, it was just moved verbatim from BasicMenuItemUI to it so that it can be called from both Basic and WindowsMenuItemUI class with no changes..nothing more and nothing less...probably it can be optimized but I wanted to keep the call and the content in each method in SwingUtilities3 same as it was in BasicMenuItemUI
They can be added parameters to SU3.paintAccText.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2267355945
More information about the client-libs-dev
mailing list