Hi David,

[email protected] wrote:
Hi,

Did you receive any useful replies to your query?

I am having exactly the same problem. It is an application that is written with 
Swing and was recently migrated from Java 1.4 to Java 1.6 .


  Typically issues like this are caused by doing something Swing-related
  off the EDT. Make absolutely sure you aren't doing something like that.

  For example, in the quoted email I don't see scrollToEnd() in
  the stack trace which may be an indicator that it's
  being called from a wrong thread.

  Thanks,
    Dmitri



David

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() );

crollPane.getVerticalScrollBar().setValue(scrollPane

getVerticalScrollBar().getMaximum());
      }
textArea.invalidate();
   }
nd here is a sample of the exception.

Exception in thread "AWT-EventQueue-0"
java.lang.NullPointerException
        at
ing.BufferStrategyPaintManager.flushAccumulatedRegion(
BufferStrategyPaintManager.java:406)
        at
ing.BufferStrategyPaintManager.endPaint(BufferStrategy
PaintManager.java:370)
at
javax.swing.RepaintManager.endPaint(RepaintManager.jav
a:1192)
at
javax.swing.JComponent._paintImmediately(JComponent.ja
va:5076)
at
javax.swing.JComponent.paintImmediately(JComponent.jav
a:4880)
        at
ing.RepaintManager.paintDirtyRegions(RepaintManager.ja
va:723)        at
javax.swing.RepaintManager.paintDirtyRegions(RepaintMa
nager.java:679)        at
javax.swing.RepaintManager.seqPaintDirtyRegions(Repain
tManager.java:659)
        at
ing.SystemEventQueueUtilities$ComponentWorkRequest.run
(SystemEventQueueUtilities.java:128)
at
java.awt.event.InvocationEvent.dispatch(InvocationEven
t.java:209)
at
java.awt.EventQueue.dispatchEvent(EventQueue.java:597)

        at
.EventDispatchThread.pumpOneEventForFilters(EventDispa
tchThread.java:273)
        at
.EventDispatchThread.pumpEventsForFilter(EventDispatch
Thread.java:183)
        at
.EventDispatchThread.pumpEventsForHierarchy(EventDispa
tchThread.java:173)
        at
.EventDispatchThread.pumpEvents(EventDispatchThread.ja
va:168)        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchT
hread.java:160)        at
java.awt.EventDispatchThread.run(EventDispatchThread.j
ava:121)
[Message sent by forum member 'dziants' (dziants)]

http://forums.java.net/jive/thread.jspa?messageID=323777

===========================================================================
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".

Reply via email to