I'm using BorderFactory to create a titled border with a Substance UI themed Swing user interface, and I'm coming across the exception shown below. I tried with LineBorder and it works perfectly, but it appears that Substance UI is interfering somehow with TitledBorder. The border drawing is done in paintComponent via:
A workaround is to create a parent JPanel and setting it on that instead, which seems like a bit of a cop-out.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.pushingpixels.lafwidget.utils.RenderingUtils.desktopHints(RenderingUtils.java:113)
at org.pushingpixels.lafwidget.utils.RenderingUtils.installDesktopHints(RenderingUtils.java:85)
at org.pushingpixels.substance.internal.utils.border.SubstanceEtchedBorder.paintBorder(SubstanceEtchedBorder.java:132)
at javax.swing.border.TitledBorder.paintBorder(TitledBorder.java:330)
at javax.swing.JComponent.paintBorder(JComponent.java:947)
at javax.swing.JComponent.paint(JComponent.java:1055)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paint(JComponent.java:1063)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:585)
at javax.swing.JComponent.paintChildren(JComponent.java:887)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5213)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1493)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1424)
at javax.swing.RepaintManager.paint(RepaintManager.java:1217)
at javax.swing.JComponent.paint(JComponent.java:1040)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:78)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:115)
at java.awt.Container.paint(Container.java:1951)
at java.awt.Window.paint(Window.java:3814)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:792)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:739)
at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:688)
at javax.swing.RepaintManager.access$700(RepaintManager.java:59)
at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1632)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:660)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
I'm using BorderFactory to create a titled border with a Substance UI themed Swing user interface, and I'm coming across the exception shown below. I tried with LineBorder and it works perfectly, but it appears that Substance UI is interfering somehow with TitledBorder. The border drawing is done in paintComponent via:
if (getBorder() != null) { getBorder().paintBorder(this, g, 0, 0, getWidth(), getHeight()); }
A workaround is to create a parent JPanel and setting it on that instead, which seems like a bit of a cop-out.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at org.pushingpixels.lafwidget.utils.RenderingUtils.desktopHints(RenderingUtils.java:113) at org.pushingpixels.lafwidget.utils.RenderingUtils.installDesktopHints(RenderingUtils.java:85) at org.pushingpixels.substance.internal.utils.border.SubstanceEtchedBorder.paintBorder(SubstanceEtchedBorder.java:132) at javax.swing.border.TitledBorder.paintBorder(TitledBorder.java:330) at javax.swing.JComponent.paintBorder(JComponent.java:947) at javax.swing.JComponent.paint(JComponent.java:1055) at javax.swing.JComponent.paintChildren(JComponent.java:887) at javax.swing.JComponent.paint(JComponent.java:1063) at javax.swing.JComponent.paintChildren(JComponent.java:887) at javax.swing.JComponent.paint(JComponent.java:1063) at javax.swing.JComponent.paintChildren(JComponent.java:887) at javax.swing.JComponent.paint(JComponent.java:1063) at javax.swing.JComponent.paintChildren(JComponent.java:887) at javax.swing.JComponent.paint(JComponent.java:1063) at javax.swing.JLayeredPane.paint(JLayeredPane.java:585) at javax.swing.JComponent.paintChildren(JComponent.java:887) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5213) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1493) at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1424) at javax.swing.RepaintManager.paint(RepaintManager.java:1217) at javax.swing.JComponent.paint(JComponent.java:1040) at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39) at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:78) at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:115) at java.awt.Container.paint(Container.java:1951) at java.awt.Window.paint(Window.java:3814) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:792) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:739) at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:688) at javax.swing.RepaintManager.access$700(RepaintManager.java:59) at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1632) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEvent(EventQueue.java:660) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)