RFR: 8301302: Platform preferences API [v46]

Kevin Rushforth kcr at openjdk.org
Thu Dec 7 15:58:26 UTC 2023


On Thu, 7 Dec 2023 01:05:44 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> Please read [this document](https://gist.github.com/mstr2/9f46f92c98d3c86aa6a0b4224a9a6548) for an introduction to the Platform Preferences API, and how it interacts with the proposed style theme and stage appearance features.
>
> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
> 
>   renamed Windows.SPI.HighContrastOn to Windows.SPI.HighContrast

With the latest set of changes, this looks good to me. I left a couple questions / minor comments (mostly for follow-up) and answered a couple of Nir's questions.

modules/javafx.graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java line 779:

> 777:                     if (highContrastScheme == null) {
> 778:                         return;
> 779:                     }

Minor: You could eliminate the null check if you defined a new "NONE" or "UNKNOWN" enum and restored the (no-op) `default:` on line 837. It's fine the way you have it, if you prefer.

modules/javafx.graphics/src/main/java/com/sun/javafx/application/WindowsHighContrastScheme.java line 80:

> 78:         // since we might be running on a JVM with a locale that is different from the OS.
> 79:         for (WindowsHighContrastScheme item : values()) {
> 80:             for (ResourceBundle resourceBundle : resourceBundles) {

Depending on how often this is called, might it be worth caching a `Map<String,WindowsHighContrastScheme>` whose keys are the OS theme names and values are the corresponding enum values? This could be a follow-up enhancement if it were deemed important enough, but maybe it doesn't matter.

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

Marked as reviewed by kcr (Lead).

PR Review: https://git.openjdk.org/jfx/pull/1014#pullrequestreview-1770417179
PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1419138607
PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1419153011


More information about the openjfx-dev mailing list