O'Reilly logo

Java™ Drawing with Apache Batik: A Tutorial by Alexander Kolesnikov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using SVG Creator

As the name implies, SVG Creator can be used to create SVG documents. I illustrate the use of this class by writing the Creator class. To make learning easier, I first show the skeleton of this class in Listing 2.1. The complete source code is presented in Listing 2.2.

Listing 2.1. The Creator class (skeleton)
package com.brainysoftware.batik; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Creator extends JFrame implements ActionListener { // Declare buttons private JButton btnCircle, btnSquare; // Constructor public Creator() { super("SVG Creator"); // The default close operation this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required