Integrated: 8170794: [macosx] Error when using setDesktopManager on a JDesktopPane on MacOS X with Look and Feel Aqua
Prasanta Sadhukhan
psadhukhan at openjdk.org
Mon Jul 25 10:36:02 UTC 2022
On Thu, 7 Jul 2022 11:11:27 GMT, Prasanta Sadhukhan <psadhukhan at 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 <psadhukhan at 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
More information about the client-libs-dev
mailing list