<Swing Dev> [12] RFR JDK-8213843: Changing L&F from Nimbus to Window L&F causes NPE in SwingSet2
Prasanta Sadhukhan
prasanta.sadhukhan at oracle.com
Wed Nov 21 10:27:24 UTC 2018
Hi All,
Please review a fix for an issue seen where when we switch look and feel
from Nimbus to
Windows or any other l&f, it causes a NPE in SwingSet2 demo.
NPE is caused by SynthButtonUI.getMinimumSize() calling
SynthContext.getStyle().getGraphicsUtils()...when getStyle() return null.
This is because when we switch L&F, uninstallDefaults() is called where
style is set to null.
This is a regression introduced in jdk12 by the fix of
8192888: AllSwingComponentsBaselineTest fails with NullPointerException
for NimbusLookAndFeel
where caching of SynthButtonUI is done. It seems caching of button ui
object causes SynthButtoUI.getMinimumSize() to be called again
whereas without caching, the SynthButtonUI class is not invoked when
Container.layout() lay outs the components when we switch L&F from
nimbus to something else.
As a fix, I have removed the caching from SynthButtonUI#createUI and
updating the "style" in getBaseline() if the style is null to address
above 8192688 issue.
This fixes this issue, JDK-8192888 and
JDK-8213121:
<https://bugs.openjdk.java.net/browse/JDK-8213121>javax/swing/GraphicsConfigNotifier/StalePreferredSize.java
fails on mac10.13
Bug: https://bugs.openjdk.java.net/browse/JDK-8213843
webrev: http://cr.openjdk.java.net/~psadhukhan/8213843/webrev.0/
Regards
Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20181121/9c088059/attachment.html>
More information about the swing-dev
mailing list