On Mon, 30 Jun 2025 02:16:40 GMT, Prasanta Sadhukhan <psadhuk...@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

Reply via email to