JDK-6408269 : Refactoring: Move layout code from BasicMenuItemUI.getPreferredMenuItemSize() into DefaultMenuLayout
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-04-04
  • Updated: 2011-01-19
  • Resolved: 2006-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Relates :  
Description
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.

Comments
EVALUATION It will be done within a fix for the 6458123.
11-08-2006

EVALUATION We should do it in dolphin.
05-04-2006