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

Alexey Ivanov aivanov at openjdk.org
Mon Aug 18 16:37:56 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.

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

Depends on: https://git.openjdk.org/jdk/pull/26783

Commit messages:
 - 8365625: Can't change accelerator colors in Windows L&F

Changes: https://git.openjdk.org/jdk/pull/26826/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26826&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8365625
  Stats: 234 lines in 5 files changed: 185 ins; 35 del; 14 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