Setting the .svg image as icon to jlabel using batik toolkit
949976Aug 16 2012 — edited Aug 16 2012Hi,
I want o use .svg images in my java code.
For this,I tries with Apache's Batik toolkit.
I tried like this,
import org.apache.batik.swing.*;
import org.apache.batik.swing.svg.*;
import org.w3c.dom.svg.GetSVGDocument;
JLabel jlblsvg = new JLabel();
SVG r =new SVG(new File("C:/Users/Administrator/Desktop/fspotflower.svg").toURI().toString());
BufferedImage img = ImageIO.read(r);
jlblsvg.setIcon(new ImageIcon(img));
It's showing error in the code having SVG as "SVG cannot be resolved to a type".
I've imported all the necessary classes of batik.Still,the error continues.
Kindly,help me out.
Thanks in advance,
M.Sivapreeya