On Mon, 18 Aug 2025 16:31:00 GMT, Alexey Ivanov <[email protected]> wrote:

> **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.

This pull request has now been integrated.

Changeset: a1302e5f
Author:    Alexey Ivanov <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/a1302e5fbc1e1b41bc0b334c2502e487fa42209f
Stats:     268 lines in 5 files changed: 211 ins; 32 del; 25 mod

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

Reviewed-by: psadhukhan, kizune

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

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

Reply via email to