Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting the .svg image as icon to jlabel using batik toolkit

949976Aug 16 2012 — edited Aug 16 2012
Hi,


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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2012
Added on Aug 16 2012
1 comment
1,172 views