On Fri, 4 Jul 2025 13:23:48 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>> No, it still doesn't match the style and margins that we see in Windows File >> Explorer. >> >> The latest fix doesn't change much, *the width of the menu hasn't changed*: >> you just move the elements around trying to fit more into the same space, >> which unavoidably reduces margins between elements. >> >> The margin between the check mark / bullet and the icon should be larger, >> that popup menu in Windows File Explorer has 35 pixel-margin between the >> check mark and the icon, the latest version of the fix in this review has >> only 7 pixels. >> >> The width allocated for the popup menu has to increase where both check >> marks / bullets and icons need to be rendered. > > Compare the screenshots of File Explorer and Swing to [own > comment](https://github.com/openjdk/jdk/pull/23324#issuecomment-2705406453). > > There's so much “air” in File Explorer version of the popup menu. Yes, the > location of the elements in Swing has changed since that time, but it can't > match that in File Explorer. Usually, BasicMenuItemUI/WindowsMenuItemUI paintMenuItem (https://github.com/openjdk/jdk/blob/445e5ecd98f41d4d625af5731f7b5d10c9225e49/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java#L652-L664) renders 5 column layout via `paintCheckIcon, paintIcon, paintText, paintAccText and paintArrowIcon ` where bullet/checkmark is rendered by `paintCheckIcon` imageicon is rendered by `paintIcon` menuitem text is rendered by `paintText` accelerator text is rendered by `paintAccText ` and arrow icon for submneu is rendered by `paintArrowIcon ` This is usually the case for the rendering layout for non Windows L&F but for Windows L&F the paintIcon is rendered moot because of presence of [VistaMenuItemCheckIconFactory] (https://github.com/openjdk/jdk/blob/445e5ecd98f41d4d625af5731f7b5d10c9225e49/src/java.desktop/share/classes/sun/swing/MenuItemLayoutHelper.java#L198-L205) so paintCheckIcon only has to handle both bullet/checkmark AND imageicon so the offset needs to be adjusted in the same method and is not separate column which is why the gap may not be as per standard or expected @prrace As discussed offline, if imageicon is of different size then also the gap needs to be adjusted in that method making it more error prone.. Anyway I have tried some adjustment and latest PR looks like this <img width="427" height="410" alt="image" src="https://github.com/user-attachments/assets/bd4aac91-91e1-4668-ab05-7f34acaf5af6" /> ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2200316714