我对 java swing 有疑问。我有时会在随机时间得到这个 NullPointerException(也许在某些绘画方法?):(该项目有超过 100 个类,所以在这里发布代码没有意义,此外我对找到这种 excp 的正确方法感兴趣。这不在我的源代码中)
javax.swing.plaf.basic.BasicTextUI$RootView.paint(Unknown Source) at javax.swing.plaf.basic.BasicTextUI.paintSafely(Unknown Source) 的线程“AWT-EventQueue-0”java.lang.NullPointerException 中的异常javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source) at javax.swing.plaf.basic.BasicTextUI.update(Unknown Source) at javax.swing.JComponent.paintComponent(Unknown Source) at javax.swing.JComponent。在 javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) 在 javax.swing.RepaintManager$PaintManager.paint(Unknown Source) 在 javax.swing.在 javax.swing.JComponent._paintImmediately(Unknown Source) 在 javax.swing.JComponent 的 RepaintManager.paint(Unknown Source)。在 javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 在 javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) 在 javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 在 javax.swing.SystemEventQueueUtilities$ComponentWorkRequest。在 java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue at java.awt.event.InvocationEvent.dispatch(Unknown Source) run(Unknown Source) $1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt。 java.awt 中的 EventQueue.dispatchEvent(Unknown Source)。EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread。 java.awt.EventDispatchThread.run(未知源)上的 pumpEvents(未知源)
现在我的问题是,我应该如何/从哪里开始搜索?我不知道为什么这个 excp。出现。例外。随机出现,这也使定位变得更加困难。
那么,有人知道从哪里开始(或者可能不是我自己造成的挥杆问题)?