xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Enklaar <christian.enkl...@mbs-software.de>
Subject AW: OutOfMemoryError and JSVGCanvas not updating
Date Fri, 10 Jan 2003 10:27:49 GMT
 -----Urspr√ľngliche Nachricht-----
Von: Baron, Randy {PRG~Basel} [mailto:RANDY.BARON@Roche.COM]
Gesendet: Freitag, 10. Januar 2003 11:12
An: batik-users@xml.apache.org
Betreff: OutOfMemoryError and JSVGCanvas not updating

Hi !
I guess doHighLighting() causes the gvtTree to be rendered again and again ... 

Maybe you should try this instead
RunnableQueue rq = canvas.getQueue();
rq.invokeLater(new Runnable() {
    public void run() {
        // ...   doOtherTextDecorations();
        // ...and handle clicks on text and changes to highlighting    
after you have set the svgDocument to the canvas.
Greetings, Christian.
 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) {
                   // ...   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. 


View raw message