Skip to content

Commit c3d7a19

Browse files
committed
backport 21480a7ae8dce67cf3a844d8caafb0b96c37ac0e
1 parent 57abd30 commit c3d7a19

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/java.desktop/windows/classes/sun/awt/windows/ThemeReader.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -100,21 +100,30 @@ public static boolean isXPStyleEnabled() {
100100
return xpStyleEnabled;
101101
}
102102

103-
private static Long openThemeImpl(String widget, int dpi) {
104-
Long theme;
103+
private static long openThemeImpl(String widget, int dpi) {
104+
long theme;
105105
int i = widget.indexOf("::");
106106
if (i > 0) {
107107
// We're using the syntax "subAppName::controlName" here, as used by msstyles.
108108
// See documentation for SetWindowTheme on MSDN.
109109
setWindowTheme(widget.substring(0, i));
110-
theme = openTheme(widget.substring(i + 2), dpi);
110+
theme = getOpenThemeValue(widget.substring(i + 2), dpi);
111111
setWindowTheme(null);
112112
} else {
113-
theme = openTheme(widget, dpi);
113+
theme = getOpenThemeValue(widget, dpi);
114114
}
115115
return theme;
116116
}
117117

118+
private static long getOpenThemeValue(String widget, int dpi) {
119+
long theme;
120+
theme = openTheme(widget, dpi);
121+
if (theme == 0) {
122+
theme = openTheme(widget, defaultDPI);
123+
}
124+
return theme;
125+
}
126+
118127
// this should be called only with writeLock held
119128
private static Long getThemeImpl(String widget, int dpi) {
120129
return dpiAwareWidgetToTheme.computeIfAbsent(dpi, key -> new HashMap<>())

test/jdk/javax/swing/JTable/JTableScrollPrintTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
/*
4242
* @test
4343
* @key headful
44-
* @bug 8210807 8322140
44+
* @bug 8210807 8322140 8322135
4545
* @library /java/awt/regtesthelpers
4646
* @build PassFailJFrame
4747
* @summary Test to check if JTable can be printed when JScrollPane added to it.

test/jdk/javax/swing/JTable/PrintAllPagesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
2222
*/
2323
/*
2424
* @test
25-
* @bug 8257810
25+
* @bug 8257810 8322135
2626
* @library /java/awt/regtesthelpers
2727
* @build PassFailJFrame
2828
* @summary Verifies if all pages are printed if scrollRectToVisible is set.

0 commit comments

Comments
 (0)