**Issue:** https://bugs.openjdk.org/browse/JDK-8294427 starts to use this API https://learn.microsoft.com/en-us/windows/win32/api/uxtheme/nf-uxtheme-openthemedatafordpi
which was introduced only in Windows 10 1703. So the theming engine won't load on anything earlier like the original windows 10 or windows 8.1 etc. So as an undocumented side-effect it completely breaks the theming of Windows L&F on anything earlier and it falls back to hard-coded rendering like Windows NT/Windows 2000 Whilst those older versions are technically out of at least "mainstream" support, this is not the way to make that breaking change and I see this fix has been backported to older releases which expect stability it seems to me that this code should NOT fail if the new API is missing and instead fall back to the old code. No one will care about a pixel being off on hi-dpi if the entire UI is wrong. **Fix:** Added fallback path to support older versions of Windows that do not support OpenThemeDataForDpi(). **Testing:** Tested on my Windows 10 machine with and without the fallback path and it works as expected. Alexey tested on Windows 7 and on Windows 10 v1607 — it works correctly (jdk 21.0.2 can't render themes as reported). He also tested on Windows 11 . ------------- Commit messages: - code cleanup - Ensure either OpenThemeDataForDpiFunc or OpenThemeDataFunc is present - Declare InitThemes and rescale as static - Re-wrap the conditional operator with -ForDpiFunc - Move defaultDPI to global context - Updated changes - execute fall-back Changes: https://git.openjdk.org/jdk/pull/17173/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17173&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8321151 Stats: 54 lines in 1 file changed: 43 ins; 2 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/17173.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17173/head:pull/17173 PR: https://git.openjdk.org/jdk/pull/17173