This is a question better suited for the Swing forum since the exception is in Swing repainting code: http://forums.java.net/jive/forum.jspa?forumID=74
Off the top of my head, NPEs in Swing code are very often caused by accessing Swing components from threads other than the Event Queue thread, although it's hard to tell w/o reproducible test case, which I suggest you submit when posting your question on the Swing forum. Thanks, Dmitri [EMAIL PROTECTED] wrote:
I am getting random, not repeatable NPE's in at javax.swing.BufferStrategyPaintManager.prepare. I believe they are being caused by trying to scroll to the end of a textArea in a scrollPane. These NPE's only seem to be happening on dual core machines on either Windows or Linux. I believe the following code is the culprit but can't prove it. i'm running different minor updates to Java 6. protected final void scrollToEnd() { if ( textArea instanceof JTextArea ) { ((JTextArea)textArea).setCaretPosition( ( (JTextComponent) textArea ) .getDocument().getLength() ); scrollPane.getVerticalScrollBar().setValue(scrollPane .getVerticalScrollBar().getMaximum()); } textArea.invalidate(); } And here is a sample of the exception. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(BufferStrategyPaintManager.java:406) at javax.swing.BufferStrategyPaintManager.endPaint(BufferStrategyPaintManager.java:370) at javax.swing.RepaintManager.endPaint(RepaintManager.java:1192) at javax.swing.JComponent._paintImmediately(JComponent.java:5076) at javax.swing.JComponent.paintImmediately(JComponent.java:4880) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:723) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679) at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659) at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) [Message sent by forum member 'diverdad' (diverdad)] http://forums.java.net/jive/thread.jspa?messageID=270428 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".