RFR: 8365625: Can't change accelerator colors in Windows L&F [v3]

Alexey Ivanov aivanov at openjdk.org
Tue Sep 16 15:33:07 UTC 2025


> **Problem:**
> 
> The colors for the accelerators are cached in static fields: `disabledForeground`, `acceleratorSelectionForeground` and `acceleratorForeground`. As soon as this field is set to a non-`UIResource` value, the value cannot change.
> 
> **Fix:**
> 
> Remove the static fields for accelerator from `WindowsMenuItemUI` and use the fields inherited from `BasicMenuItemUI`, pass these fields as parameters to static methods.
> 
> Additionally, I formatted the calls to `WindowsMenuItemUI.paintMenuItem` in one consistent way.
> 
> I removed the redundant javadoc from `paintMenuItem` and added the missing `@Override` annotation.
> 
> I provided a regression test. The test also reproduces [JDK-8365375](https://bugs.openjdk.org/browse/JDK-8365375) that was resolved in #26743.

Alexey Ivanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains nine commits:

 - Update instructions to include the set of disabled menu items
 - Add disabled menu items to verify for MenuItem.disabledForeground
 - Merge master
 - Merge master
 - Align parameter list in WindowsMenuUI.paintMenuItem.
 - Merge master
   
   Accepted the versions of
    * WindowsCheckBoxMenuItemUI.java
    * WindowsMenuItemUI.java
    * WindowsMenuUI.java
    * WindowsRadioButtonMenuItemUI.java
   that existed in my branch.
 - 8365625: Can't change accelerator colors in Windows L&F
 - 8365389
 - 8365389

-------------

Changes: https://git.openjdk.org/jdk/pull/26826/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26826&range=02
  Stats: 268 lines in 5 files changed: 211 ins; 32 del; 25 mod
  Patch: https://git.openjdk.org/jdk/pull/26826.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26826/head:pull/26826

PR: https://git.openjdk.org/jdk/pull/26826


More information about the client-libs-dev mailing list