Hi Fredrik,
Fredrik Medby Hagen wrote:
Hi. My problem is: when calling JSVGComponent.setDocument, document is not set (at line [*] in the code below the old doc is returned)... I have no clue of what can be the problem. I've probably gone code-blind.
The problem is that the install of the document is asynchronous most of the work is done in another thread but it needs to come back to the Swing thread to finish the install of the document.
Your waiting in the swing thread prevents this. If you want to be notified when the document is installed you should register a GVTTreeBuilderListener when it starts your document will have been installed.
---CODE---
SVGDocument oldDoc = svgCanvas.getSVGDocument(); //document before update svgCanvas.setDocument(doc); //changing to new document if(svgCanvas.getSVGDocument() == oldDoc) //if new document hasn't been installed yet (method might return before doc is set), wait 10sec //try{synchronized(dla){dla.wait(0);}}catch(Exception e){e.printStackTrace();} try{synchronized(this){wait(10000);}} catch(Exception e){e.printStackTrace(); } [*] svgDocument = svgCanvas.getSVGDocument(); //document should now have been changed.
---CODE---
Any ideas?
Sincerely,
Fredrik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
