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

Remove static color fields from SwingUtilities3 and WindowsMenuItemUI

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • 26
    • 26
    • client-libs

      The fix for JDK-8348760 added static fields that store colors to SwingUtilities3 and WindowsMenuItemUI. These parameters should not be stored as static fields in a global utility class such as SwingUtilities3. Similarly, these colors should not be stored as static fields in WindowsMenuItemUI when these values could be accessed via inherited protected fields from BasicMenuItemUI.

      This issue was raised during code review [1-7] for JDK-8348760 but it wasn't addressed.


      Additionally, the static methods WindowsMenuItemUI.applyInsets, paintCheckIcon, paintIcon [8] aren't needed—the corresponding method from SwingUtilities3 could've been called directly without introducing a new method.


      Overridden method `paintMenuItem` in WindowsMenuUI, WindowsCheckBoxMenuItemUI, WindowsRadioButtonMenuItemUI has a redundant javadoc comment [9-11]. These overridden methods lack the `@Override` annotation as well as WindowsMenuItemUI.paintMenuItem [12].


      Even though I had suggested using SwingUtilities3 [13] for the helper methods, I later suggested [14] creating a new class sun.swing.MenuItemRenderHelper similar to sun.swing.MenuItemLayoutHelper to keep both layout and renderer closer together.

      [1] https://github.com/openjdk/jdk/pull/23324#discussion_r2168941423
      [2] https://github.com/openjdk/jdk/pull/23324#discussion_r2168941423
      [3] https://github.com/openjdk/jdk/pull/23324#discussion_r2169199694
      [4] https://github.com/openjdk/jdk/pull/23324#discussion_r2169217699
      [5] https://github.com/openjdk/jdk/pull/23324#discussion_r2169219765
      [6] https://github.com/openjdk/jdk/pull/23324#discussion_r2269414401
      [7] https://github.com/openjdk/jdk/pull/23324#discussion_r2169267877

      [8] https://github.com/openjdk/jdk/pull/23324#discussion_r2169263009

      [9] https://github.com/openjdk/jdk/pull/23324#discussion_r2169272729
      [10] https://github.com/openjdk/jdk/pull/23324#discussion_r2169298130
      [11] https://github.com/openjdk/jdk/pull/23324#discussion_r2169302893
      [12] https://github.com/openjdk/jdk/pull/23324#discussion_r2169285512

      [13] https://github.com/openjdk/jdk/pull/23324#issuecomment-2707067002
      [14] https://github.com/openjdk/jdk/pull/23324#discussion_r2169334895

            psadhukhan Prasanta Sadhukhan
            aivanov Alexey Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: