單對此調用Graphics2D畫圖時就會出現一下錯誤,請各位幫忙解決
Exception in thread "AWT-EventQueue-0 " java.lang.NullPointerException
at sun.java2d.loops.DrawGlyphList.DrawGlyphList(Native Method)
at sun.java2d.pipe.SolidTextRenderer.drawGlyphList(SolidTextRenderer.java:36)
at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:53)
at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2642)
at ns.client.print.PreViewPanel.drawFrame(PreViewPanel.java:787)
at ns.client.print.PreViewPanel.drawPage(PreViewPanel.java:119)
at ns.client.print.PreViewPanel.print(PreViewPanel.java:1063)
at ns.client.print.PrintPreviewCanvas.paintComponent(PrintPreviewCanvas.java:57)
at javax.swing.JComponent.paint(JComponent.java:1005)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4970)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916)
at javax.swing.JComponent.paint(JComponent.java:995)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1709)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:254)
at java.awt.Component.dispatchEventImpl(Component.java:4031)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
------解决方案--------------------
估计在自己的线程里面调用绘图方法。推荐swing 线程
-------------------------------------
www.foxou.cn欢迎您
------解决方案--------------------
頂一下.....
------解决方案--------------------
可以尝试到一个新的技术社区回答www.nlld.net