You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by sophia <ja...@freenet.de> on 2006/11/08 10:37:20 UTC
componentUI + JSVGCanvas
Hi,
I'm trying to convert swing components to svg using SwingSVGPrettyPrint. For
most components it works fine but
when I try to convert a JSVGCanvas object (most of the time) I get the
following error:
UIDefaults.getUI() failed: no ComponentUI class for:
org.apache.batik.swing.JSVGCanvas
the code is:
//this is needed to get all components visible (e.g. if swing is a
JSplitPane object or any other object which
//contains JComponent object)
//this method might be part of the error because sometimes when i don't use
this method and start directly
//to convert, the whole thing works (but sometimes not....). so any ideas
about getting all components visible
//wihtout using this method are welcome
private static final void packIt(JComponent swing) {
JFrame frame = new JFrame();
frame.add(swing);
frame.pack();
}
public static final void convert(JComponent swing, OutputStream out) {
DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
org.w3c.dom.Document document =
domImpl.createDocument("http://www.w3.org/2000/svg", "svg:svg", null);
SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document);
SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
packIt(swing);
SwingSVGPrettyPrint.print(swing, svgGenerator);
...
Thanks for any advice
--
View this message in context: http://www.nabble.com/componentUI-%2B-JSVGCanvas-tf2594147.html#a7235319
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org