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 "Baron, Randy {PRG~Basel}" <RA...@Roche.COM> on 2003/01/10 11:12:23 UTC

OutOfMemoryError and JSVGCanvas not updating

Hi -
  I am getting some text from a database and drawing it on a JSVGCanvas
and then adding some decorations, e.g. highlighting in the form of
partially transparent rectangles over the text.  Originally I tried to
create the whole svg document in memory then set it to be displayed but
this failed, sometimes, because I used
aTextElementNode.getBounds().getWidth() to determine the size of a line
and I suppose the size was undefined because the text hadn't been
rendered yet.  I put all of these render-sensitive calls inside a block
like this:
 
canvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
            public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
                      doHighLighting();
                   // ...   doOtherTextDecorations();
                   // ...and handle clicks on text and changes to
highlighting
            }
        });
 
and it seems to have solved that problem, although it seems a bit
strange to have basically put the entire rest of the program inside the
GVTTreeRendererListener.  However, two new problems came up:
1st: The highlight boxes only appear after you move the mouse over the
JSVGCanvas.
2nd: If the enclosing JFrame is resized, the following error occurs.
The OutOfMemory line appears once, the next section is repeated over and
over a couple hundred times.
 
java.lang.OutOfMemoryError
java.lang.IllegalStateException: RunnableQueue not started or has exited
            at org.apache.batik.util.RunnableQueue.invokeLater(Unknown
Source)
            at
org.apache.batik.swing.svg.JSVGComponent$SVGListener.dispatchMouseEntere
d(Unknown Source)
            at
org.apache.batik.swing.gvt.JGVTComponent$Listener.mouseEntered(Unknown
Source)
            at
java.awt.AWTEventMulticaster.mouseEntered(AWTEventMulticaster.java:237)
            at java.awt.Component.processMouseEvent(Component.java:5030)
            at java.awt.Component.processEvent(Component.java:4818)
            at java.awt.Container.processEvent(Container.java:1525)
            at java.awt.Component.dispatchEventImpl(Component.java:3526)
            at java.awt.Container.dispatchEventImpl(Container.java:1582)
            at java.awt.Component.dispatchEvent(Component.java:3367)
            at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359)
            at
java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:3199)
            at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3056)
            at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
            at java.awt.Container.dispatchEventImpl(Container.java:1568)
            at java.awt.Window.dispatchEventImpl(Window.java:1581)
            at java.awt.Component.dispatchEvent(Component.java:3367)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
            at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThrea
d.java:191)
            at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.
java:144)
            at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
            at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
            at
java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
 
  If anyone has any input on either of these problems it would be
appreciated.
-Randy