I am currently developing a Swing application which shall execute on every platform. The general application is not the problem, it works fine on Windows, Linux and Mac.
But I have this JComboBox
that displays in addition to the text also an Icon
(size 50x50).
I do understand, that Mac has strict layout rules and that oversized JComboBoxes
are not really wanted.
The problem is, that using the Mac Look-and-Feel
, my JComboBoxes
have correct width but the height is way too small (same height as if there would not be an icon). Therefore the top and bottom part of my Icon
are cut off which does not really look nice.
Displaying the JComboBox
without the Icon
does not make sense, but I have not found a solution so far to display the JComboBox
with the correct height (even setting MinimumSize
, PreferredSize
and MaximumSize
to icon.getIconHeight()+2
does not help). Using Windows or Linux the JComboBoxes
are displayed correctly.
Is there any property I could use or do I really have to live with the cut off icons?