EVALUATION
The cause is in MenuItemLayoutHelper class. It uses SwingUtilities.layoutCompoundLabel() to determine label width and to lay out icon and text in the case of the complex layout. The method takes into account the text bearings for layout purposes, however it doesn't for text rectangle width calculation. In the case of the CENTER layout MenuItemLayoutHelper supposes label width is equal to the text rectangle width (without bearings). When it is time to lay out the label, text width turns out too small to do it. layoutCompoundLabel() trims the text, ends it with "..." and uses the trimmed text for layout. It causes the bug.
A solution is simple. We should take into account the text bearings when we use layoutCompoundLabel() to determine the label width.
|