Search code examples
javaswinggraphicsjpanelpaintcomponent

How to draw a vector graphic on a JPanel


If I want to draw a normal bitmap image on a JPanel I simply call "graphics.drawImage(...)" in the panels "paint(Graphics graphics)" or "paintComponent(Graphics graphics)" method. How can I draw a vector graphic on a JPanel?

Regards


Solution

  • Batik is an SVG library for Java. You should be able to use a JSVGCanvas to do what you want.

    http://xmlgraphics.apache.org/batik/using/swing.html