Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6408269

Refactoring: Move layout code from BasicMenuItemUI.getPreferredMenuItemSize() into DefaultMenuLayout

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • 7
    • 7
    • client-libs

      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.

            mlapshin Mikhail Lapshin (Inactive)
            mlapshin Mikhail Lapshin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: