You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Phil Wright <ph...@gmail.com> on 2006/11/25 23:47:31 UTC

Problem with SVGCanvas refresh

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.

Resizing the window will also cause the display to update and the whole
document is visible again.

The app in question has a JFrame, with two JToolbars one of which contains
the JLabel.  The JSVGCanvas is in a JInternalFrame inside the main JFrame as
well.

I tried putting in a canvas.repaint() call after the label update but that
did nothing.

    Phil

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

Re: Problem with SVGCanvas refresh

Posted by th...@kodak.com.
Hi Phil,

"Phil Wright" <ph...@gmail.com> wrote on 11/26/2006 07:51:25 PM:

> > 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).

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

   Ahh, I thought we were talking about DOM mouse move listeners.

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

   Well, I haven't seen this problem before, and the above make it sound
like it's a problem in the new JVM.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Problem with SVGCanvas refresh

Posted by Phil Wright <ph...@gmail.com>.
Hi Thomas,

On 11/26/06, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
> Hi Phil,
>
> "Phil Wright" <ph...@gmail.com> 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.

Re: Problem with SVGCanvas refresh

Posted by th...@kodak.com.
Hi Phil,

"Phil Wright" <ph...@gmail.com> 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.

> Resizing the window will also cause the display to update and the whole 
> document is visible again.
> 
> The app in question has a JFrame, with two JToolbars one of which 
contains the
> JLabel.  The JSVGCanvas is in a JInternalFrame inside the main JFrame as 
well. 
> 
> I tried putting in a canvas.repaint() call after the label update but 
that did nothing.
> 
>     Phil
> 
> -- 
> Visit http://www.darkisle.com for photos of castles, cairns and other 
historic
> sites in the British Isles. 

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org