Hi Thomas,

On 11/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi Phil,

"Phil Wright" <[EMAIL PROTECTED]> wrote on 11/25/2006 05:47:31 PM:

> I have a problem where immediately after I add a new graphic element to
a
> document the entire document view clears except for the most recently
added
> element.  The problem started when I added a call to update a JLabel in
the
> MouseMove listener.  Take out the setText() call and the document view
is fine.

   My first guess is that you are modifying the Swing tree outside of the
AWT event thread (all DOM events are delivered in the UpdateManager
Thread).
In this case the 'setText()' may be changing the size of the label which
might cause resize stuff to happen which might be problematic if it is
triggered outside of the AWT thread.


Could be though I make the call directly in the mouseMoved()
MouseMotionListener.

Am I getting DOM events?  All the mouse interaction happens via a
MouseMotionListener and a MouseListener added to the canvas.  Those are the
only listeners on the canvas.

All the calls to modify the document are wrapped like this:

           canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(
               new Runnable() {
                   public void run() {
                       elt.appendChild(e);
                   }
               });

The JLabel isn't changing size as it has a fixed size.  There are JButtons
and JToggleButtons on the GUI that have their states changed in a similar
fashion but it is only this JLabel that causes problems.

I have discovered that this problem doesn't happen when it is run under Java
1.5.0_06 but does under 1.5.0_07.  Which may or may not mean anything.

Anyway thanks again for your help and insight.

   Phil




--
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.

Reply via email to