On Thu, 7 Jul 2022 11:11:27 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

> When we call JDesktopPane.setDesktopManager(new DefaultDesktopManager()) and 
> try to iconify an internalframe, it results in NPE
> 
> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
> at 
> javax.swing.RepaintManager.getVolatileOffscreenBuffer(RepaintManager.java:1030)
> at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1489)
> at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
> at javax.swing.JComponent.paint(JComponent.java:1042)
> at javax.swing.JComponent.paintChildren(JComponent.java:889)
> at javax.swing.JComponent.paint(JComponent.java:1065)
> at 
> com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.updateIcon(AquaInternalFrameDockIconUI.java:193)
> at 
> com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.paint(AquaInternalFrameDockIconUI.java:204)
> at javax.swing.JComponent.paintChildren(JComponent.java:889)
> at javax.swing.JComponent.paint(JComponent.java:1065)
> at javax.swing.JComponent.paintChildren(JComponent.java:889)
> at javax.swing.JComponent.paint(JComponent.java:1065)
> at javax.swing.JLayeredPane.paint(JLayeredPane.java:586) 
> 
> 
> it seems the RepaintManager.getVolatileOffscreenBuffer() is called with 
> JRootPane component for AquaLookAndFeel because of which 
> SwingUtilities.getWindowAncestor(JRootPane) returns null causing NPE.
> 
> Fixed by adding a null check. The JInternalFrame can be successfully iconized 
> now after setting DesktopManager.

This pull request has now been integrated.

Changeset: d0c365a7
Author:    Prasanta Sadhukhan <psadhuk...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/d0c365a7b91de2fdfacdb0e107174549b7a9860e
Stats:     106 lines in 2 files changed: 105 ins; 0 del; 1 mod

8170794: [macosx] Error when using setDesktopManager on a JDesktopPane on MacOS 
X with Look and Feel Aqua

Reviewed-by: prr

-------------

PR: https://git.openjdk.org/jdk/pull/9408

Reply via email to