On Thu, 15 Jan 2026 12:29:59 GMT, Alexey Ivanov <[email protected]> wrote:
> Is it because Windows icons used to be special and combined the icon and > check mark / bullet mark, or rather replaced the check mark / bullet mark > with the icon? Should we get rid of that special treatment? I am reusing the VistaMenuItemCheckIcon to render the RadioButtonMenuItem and CheckBoxMenuItem icons and getting rid of the working/treatment made in that class (and rewriting) might result in more regressions which I am avoiding.. There are many factors apart from normal that is affecting the icon position like `menuItem.setHorizontalTextPosition(LEADING/TRAILING/LEFT/RIGHT etc)`, `menuItem.setHorizontalTextPosition(RIGHT/CENTER etc)` which can cause issues like what we are seeing in https://github.com/openjdk/jdk/pull/28210 which atleast is working now for Windows L&F without any rework. Metal L&F seems to hardcode the icon position to (0,0) or (2,2) https://github.com/openjdk/jdk/blob/e4474ad8ae250771e031b8c18809d3e461970365/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalIconFactory.java#L2268-L2302 whereas I am reusing the methodology in VistaMenuItemIcon using OFFSET and it seems to work for cases seen till now.. >> it is taken care via ternary operator, width/spread of check mark is usually >> more than radio bullet so starting point of checkmark is considered a little >> ahead compared to radio bullet > > I see that it's taken care by the ternary operator. Why is it needed, though? > > The skin for both check mark and radio bullet have the same size, and the > mark is positioned accordingly inside the rectangle. This works well for the > LTR layout, both marks are rendered at the same location and appear aligned > in the end. Why does RTL layout treat these marks differently? As told and code shown earlier, the RTL oversees overall rectangle width using all text rect, image icon rect, icon rect etc to calculate icon x position unlike LTR and it seemed a bit off for checkmark as compared to bullet by 1 or 2 pixel or so I catered to it by this logic ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28889#discussion_r2696785303 PR Review Comment: https://git.openjdk.org/jdk/pull/28889#discussion_r2696788855
