DocumentBuilderFactory domFactory= DocumentBuilderFactory.newInstance();
domFactory.setCoalescing(true);
domFactory.setExpandEntityReferences(true);
domFactory.setIgnoringComments(true);
domFactory.setNamespaceAware(true);
domFactory.setValidating(false);
domFactory.setNamespaceAware(true);
DocumentBuilder domBuilder= domFactory.newDocumentBuilder();
Document dom=domBuilder.parse("http://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg");
SVGIcon icon= new SVGIcon(dom,256,256);
JOptionPane.showMessageDialog(null, new JLabel(icon),"SVG Icon",JOptionPane.PLAIN_MESSAGE);
domFactory.setCoalescing(true);
domFactory.setExpandEntityReferences(true);
domFactory.setIgnoringComments(true);
domFactory.setNamespaceAware(true);
domFactory.setValidating(false);
domFactory.setNamespaceAware(true);
DocumentBuilder domBuilder= domFactory.newDocumentBuilder();
Document dom=domBuilder.parse("http://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg");
SVGIcon icon= new SVGIcon(dom,256,256);
JOptionPane.showMessageDialog(null, new JLabel(icon),"SVG Icon",JOptionPane.PLAIN_MESSAGE);
Source code is available at
http://code.google.com/p/lindenb/source/browse/trunk/src/java/org/lindenb/svg/SVGRenderer.java
http://code.google.com/p/lindenb/source/browse/trunk/src/java/org/lindenb/svg/SVGRenderer.java
That's it.
Pierre
A - thanks was exactly looking for this (this meaning a simple class example to create a renderer for lwjgl).
ReplyDeleteWhile I'm not a phd, I studied genetics in college and I'm also a java geek now.
Cheers!