• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 17. Using SVG in Java Applicatio... > Generating SVG with a Java Applicati...

Generating SVG with a Java Application

The ability to display SVG in Java has its uses, but probably your first requirement as a Java developer is to get your application to generate SVG. Using Batik, you can do so in two main ways: using the SVG Generator (SVGGraphics2D) and using the SVG DOM.

When you use the first method—which, for want of a better word, is “shallow”—the generator is normally sent a completely drawn Swing object, and it pumps out a complete SVG representation of this object. This approach is eminently suitable for tagging onto existing applications. The code needed to use the generator is minimal, and the only other step required is to add the necessary user interface (such as an Export to SVG menu item) and use it to pick up the object to draw and pass it to the generator.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint