Hi Krishna,
updateStyle creates a new context whereas SynthLookAndFeel.updateStyle
updates the style for present context
Regards
Prasanta
On 9/10/2018 4:57 PM, Krishna Addepalli wrote:
Hi Prasanta,
Is there any reason why you are explicitly calling
SynthLookAndFeel.updateStyle compared to the updateStyle function
present in the same class?
Thanks,
Krishna
*From:*Prasanta Sadhukhan
*Sent:* Friday, September 7, 2018 4:28 PM
*To:* [email protected]
*Subject:* <Swing Dev> [12] RFR JDK-8192888:
AllSwingComponentsBaselineTest fails with NullPointerException for
NimbusLookAndFeel
Hi All,
Please review a fix for an issue where obtaining baseline for Button
UI in Nimbus L&F results in NPE.
Reason for it is when SynthPanelUI#installDefaults is called during
frame instantiation, it calls SynthPanelUI#updateStyle which sets the
context AND then the style
/private void updateStyle(JPanel c) {
SynthContext context = getContext(c, ENABLED);
style = SynthLookAndFeel.updateStyle(context, this);
}/
Now, SynthContext.getContext is called with style "null" as style is
updated after calling getContext.
So, when getBaseline is called and it tries to invoke
context.getStyle().getGraphicsUtils() it causes NPE.
Proposed fix is to updateStyle for this context for this SynthUI
object if style is found to be null.
Bug: https://bugs.openjdk.java.net/browse/JDK-8192888
webrev: http://cr.openjdk.java.net/~psadhukhan/8192888/webrev.0/
<http://cr.openjdk.java.net/%7Epsadhukhan/8192888/webrev.0/>
Regards
Prasanta