Looking through the documentation for JSVGCanvas
, it seems like I might not be able to do this. However, it makes a lot of sense for this to be possible. How can I create a JSVGCanvas
from a String
variable instead of a File
?
My idea is that I could do something like the following:
String svg = "svg data";
JFrame frame = new JFrame();
JSVGCanvas canvas = new JSVGCanvas();
canvas.setContentsFromString(svg);
frame.add(canvas);
frame.setVisible(true);
I know I could always create a temporary file and set the contents of the JSVGCanvas
from the file, but I'd rather avoid that. Could I perhaps extend File
and override its methods?
Note: I am using Jython, but I think that this is relevant for Java as well, hence I'm using both tags. I'd prefer that a solution be in Java, but a Jython solution would work