<Swing Dev> [12] RFR JDK-8192888: AllSwingComponentsBaselineTest fails with NullPointerException for NimbusLookAndFeel
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Tue Sep 11 21:09:18 UTC 2018
Hi, Prasanta.
On 07/09/2018 03:57, Prasanta Sadhukhan wrote:
> 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.
Why SynthLookAndFeel.updateStyle() which is called in
SynthButtonUI.updateStyle(AbstractButton b) did not update the context
which is passed to it? Is it possible that
SynthButtonUI.installDefaults() was not called before getBaseline()?
--
Best regards, Sergey.
More information about the swing-dev
mailing list