Hi control_batik <[EMAIL PROTECTED]> wrote on 09/15/2008 11:21:49 AM:
> Thank you for your answer > Well, when I add the small icons , i do it in the > UpdateManager's RunnableQueue. Can you send a screen shot of what the 'white areas' look like? Are they large or 'slivers'? > I don't get any exceptions. It's really hard for me to imagine how you would get white areas without either getting exceptions or doing stuff outside of the RunnableQueue. > I am using these java VM parameters -Xms32m -Xmx500m, and > when I watch the memory consume of the process , it's not > bigger than 200m, so i think it has enough memory. > When I add the small svg images, I do it of this way: > > UpdateManager um = null; > while (um == null) um = > this.svgCanvas.getUpdateManager(); > um.getUpdateRunnableQueue().invokeLater(r); > > where in r is the code that modify the svg file, > It works but I'm not sure that it's the best way. > First, I create a new svg document, then I set it as the > document of the canvas, of this way: > > svgCanvas.setSVGDocument((SVGDocument) basedocument); > > Next , to this document I add the big svg file: > > root.appendChild(basedocument.importNode(ele, true)); > > I add a addGVTTreeBuilderListener to the canvas, > when the render process it's complete I show it in a > jframe, so in this case i don't use the UpdateManager's > RunnableQueue but I think using the listener it should > be ok, so the root it's the empty document. The > big svg file and the icons are added to this root. It's not clear for what you wrote above if you are doing this every time you add an icon or if somewhere in there you went from the add icon code to the initial document load code. If you are doing the above every time you add an icon it's possible that the setSVGDocument outside of the Swing thread could cause problems (when working with the displayed DOM it must be in the UpdateManager, when working with the canvas it must be done in the Swing thread). If you want to add an icon you should just append it to root in the update manager thread.
