-
Enhancement
-
Resolution: Duplicate
-
P4
-
7
-
generic
-
generic
The layout code in BasicMenuItemUI (the getPreferredMenuItemSize, layoutMenuItem and paintMenuItem methods) is intricate and cumbersome.
Suggestions:
1. Do not take in account sizes of neighbour MenuItems in the BasicMenuItemUI.getPreferredSize() and BasicMenuItemUI.paint() methods.
2. Move all the layout code from BasicMenuItemUI.getPreferredSize() into DefaultMenuLayout. BasicMenuItemUI.getPreferredSize() could then just return sum of widths of all elements (icon, text, etc.) with appropriate gaps.
3. Synth would just use the same algorithm from Basic (now it is using own similar algorithm).
4. Calculate and store MAX_ICON_WIDTH, MAX_TEXT_WIDTH and MAX_ACC_WIDTH in DefaultMenuLayout or BasicMenuUI (it is the matter for the further investigations).
5. Remove using of MAX_ICON_OFFSET and MAX_TEXT_OFFSET from BasicMenuItemUI.layoutMenuItem(). Use calculated MAX_ICON_WIDTH, MAX_TEXT_WIDTH and MAX_ACC_WIDTH. Also rewrite getPreferredMenuItemSize and paintMenuItem to use the maximal widths if they are available.
Suggestions:
1. Do not take in account sizes of neighbour MenuItems in the BasicMenuItemUI.getPreferredSize() and BasicMenuItemUI.paint() methods.
2. Move all the layout code from BasicMenuItemUI.getPreferredSize() into DefaultMenuLayout. BasicMenuItemUI.getPreferredSize() could then just return sum of widths of all elements (icon, text, etc.) with appropriate gaps.
3. Synth would just use the same algorithm from Basic (now it is using own similar algorithm).
4. Calculate and store MAX_ICON_WIDTH, MAX_TEXT_WIDTH and MAX_ACC_WIDTH in DefaultMenuLayout or BasicMenuUI (it is the matter for the further investigations).
5. Remove using of MAX_ICON_OFFSET and MAX_TEXT_OFFSET from BasicMenuItemUI.layoutMenuItem(). Use calculated MAX_ICON_WIDTH, MAX_TEXT_WIDTH and MAX_ACC_WIDTH. Also rewrite getPreferredMenuItemSize and paintMenuItem to use the maximal widths if they are available.
- duplicates
-
JDK-6458123 Bugs in menu item layout
-
- Closed
-
- relates to
-
JDK-6385366 REGRESSION: Descriptive text and accelerator text overlap on JMenuItem.
-
- Resolved
-