KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > svggen > GVector


1 /*
2
3    Copyright 2001,2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.svggen;
19
20 import java.awt.Color JavaDoc;
21 import java.awt.Font JavaDoc;
22 import java.awt.Graphics2D JavaDoc;
23 import java.awt.RenderingHints JavaDoc;
24
25 /**
26  * This test validates the convertion of Java 2D GlyphVectors
27  * SVG Shapes.
28  *
29  * @author <a HREF="mailto:cjolif@ilog.fr">Christophe Jolif</a>
30  * @author <a HREF="mailto:vhardy@eng.sun.com">Vincent Hardy</a>
31  * @version $Id: GVector.java,v 1.6 2004/08/18 07:16:44 vhardy Exp $
32  */

33 public class GVector implements Painter {
34     public void paint(Graphics2D JavaDoc g) {
35          g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
36                             RenderingHints.VALUE_ANTIALIAS_ON);
37
38          // Set default font
39
Font JavaDoc font = new Font JavaDoc("Arial", Font.BOLD, 15);
40          g.setFont(font);
41
42          // Colors used for labels and test output
43
Color JavaDoc labelColor = new Color JavaDoc(0x666699);
44          g.setPaint(labelColor);
45
46          // Simple String
47
String JavaDoc text = "This is a GlyphVector";
48
49          // Get GlyphVector from from
50
java.awt.font.GlyphVector JavaDoc gv = font.createGlyphVector(g.getFontRenderContext(),
51                                                                text);
52
53          g.drawGlyphVector(gv, 30, 30);
54     }
55 }
56
Popular Tags