Hello,

I'm in Mac (I read there are some problems in Mac so it might be actually my problem, but I'd like to confirm that with you guys).

I have a JPanel with a BorderLayout in which I have added on the EAST area a JSVGCanvas loading a small arrow (originally on the file is 65px width). I want to load that arrow but resized to 100px.

I simply can't achieve this. When I run my code, the JSVGCanvas measures 69px width instead of the 100px, and there is nothing on it, it's just the panel empty with my orange background.

Here is basically what I'm doing:


private void changeWidth(final JSVGCanvas form, final int size) {
Runnable cmd=new Runnable() {
public void run() {
Element svgRoot = form.getSVGDocument().getDocumentElement();
svgRoot.setAttributeNS(null, "width", String.valueOf(size));
}
};


form.getUpdateManager().getUpdateRunnableQueue().invokeLater(cmd);
}


private JSVGCanvas buildArrow() {
try {
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
URI uri = this.getClass().getResource("/com/myapp/app/dicomview/player/arrow.svg").toURI();
final SVGDocument doc = (SVGDocument) f.createDocument(uri.toString());
Element svgRoot = doc.getDocumentElement();
final JSVGCanvas arrow=new JSVGCanvas();


arrow.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
arrow.setOpaque(true);
arrow.setVisible(true);


Color inst=new Color(Color.orange.getRed(), Color.orange.getGreen(), Color.orange.getBlue(), 75);
arrow.setBackground( inst );
arrow.addGVTTreeBuilderListener(new GVTTreeBuilderAdapter() {
@Override
public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
changeWidth(arrow, 100);
}
});


arrow.setSVGDocument(doc);

add(arrow, BorderLayout.EAST);


repaint();
return arrow;
} catch (Throwable ex) {
ex.printStackTrace(System.out);
ErrorReport.process(ex);
return null;
}
}



Can anybody please give me a hint in what could be going wrong?

Thanks!
Ruben