Closed mgarin closed 4 years ago
For reference, here is a screenshot showing metal laf with user icon along checkbox (left) and web laf (right). tooltips are shown.
Yep. I re-checked other L&Fs today to see how they handle it in menus and it is mostly handled like in MetalLookAndFeel
with a few exceptions.
I will most probably do it the same way it is done in MetalLookAndFeel
- add check/radio icon in front and move icons of all other menu items forward to line up with check/radio menu item custom icons. The implementation is already in place, I'll just need to tune a few things in UI, content layout and painter.
Ok, since I decided to fix this once and for all - I've made a different approach at rendering state icon for JCheckBoxMenuItem
and JRadioButtonMenuItem
to avoid JCheckBox
and JRadioButton
implementation affecting them anyhow.
First of all, here is the simple example state icons & custom icons:
Here is how it will align with other elements with state icons only:
And here are some normal menu items on top:
And here is a small niche case I've also added proper handling for:
This is basically the case when all state menu items do not have any custom icon while some other normal menu items are also present (with and without icons). This allows you not to have two ugly columns each of which is half-empty.
Menu will properly align even with differently-sized icons:
And even if you decide to go wild on the style:
And here is the dark example:
Alignments, paddings, layout and other settings can be adjusted for menu items in the style, although hopefully default layout and settings handle most cases. You can even disable aligning menu items:
I'll be pushing these changes shortly, just need to check everything last time.
These changes are now available in master
.
Snapshot build should also be available soon.
Right now checkbox and radio buttons (including menu items) can either display a check/radio icon or a custom icon, but not both at the same time. It would be nice to have them both.
To be more specific - changing component
Icon
should not remove or configure the check/radio icon anyhow, but instead add/remove a custom icon besides it.For menu items this also means that other items in the same menu will have to be properly aligned to check/radio+custom icon width (or ignore it?).