2
|
1 |
/*
|
|
2 |
* Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation. Sun designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Sun in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
* have any questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
package sun.java2d;
|
|
27 |
|
|
28 |
import java.awt.GraphicsEnvironment;
|
|
29 |
import java.awt.GraphicsDevice;
|
|
30 |
import java.awt.Graphics2D;
|
|
31 |
import java.awt.HeadlessException;
|
|
32 |
import java.awt.image.BufferedImage;
|
|
33 |
import java.awt.Font;
|
|
34 |
import java.text.AttributedCharacterIterator;
|
|
35 |
import java.awt.print.PrinterJob;
|
|
36 |
import java.util.Map;
|
|
37 |
import java.util.Hashtable;
|
|
38 |
import java.util.Locale;
|
|
39 |
import java.util.Vector;
|
|
40 |
import java.util.StringTokenizer;
|
|
41 |
import java.util.ResourceBundle;
|
|
42 |
import java.util.MissingResourceException;
|
|
43 |
import java.io.IOException;
|
|
44 |
import java.io.FilenameFilter;
|
|
45 |
import java.io.File;
|
|
46 |
import java.util.NoSuchElementException;
|
|
47 |
import sun.awt.FontConfiguration;
|
|
48 |
import java.util.TreeMap;
|
|
49 |
import java.util.Set;
|
|
50 |
import java.awt.font.TextAttribute;
|
|
51 |
import java.io.InputStream;
|
|
52 |
import java.io.FileInputStream;
|
|
53 |
import java.io.BufferedInputStream;
|
|
54 |
import java.util.Properties;
|
|
55 |
import java.awt.Point;
|
|
56 |
import java.awt.Rectangle;
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Headless decorator implementation of a SunGraphicsEnvironment
|
|
60 |
*/
|
|
61 |
|
|
62 |
public class HeadlessGraphicsEnvironment extends GraphicsEnvironment
|
|
63 |
implements FontSupport {
|
|
64 |
|
|
65 |
private GraphicsEnvironment ge;
|
|
66 |
private FontSupport fontSupport;
|
|
67 |
|
|
68 |
public HeadlessGraphicsEnvironment(GraphicsEnvironment ge) {
|
|
69 |
this.ge = ge;
|
|
70 |
if (ge instanceof FontSupport) {
|
|
71 |
fontSupport = (FontSupport)ge;
|
|
72 |
}
|
|
73 |
}
|
|
74 |
|
|
75 |
public GraphicsDevice[] getScreenDevices()
|
|
76 |
throws HeadlessException {
|
|
77 |
throw new HeadlessException();
|
|
78 |
}
|
|
79 |
|
|
80 |
public GraphicsDevice getDefaultScreenDevice()
|
|
81 |
throws HeadlessException {
|
|
82 |
throw new HeadlessException();
|
|
83 |
}
|
|
84 |
|
|
85 |
public Point getCenterPoint() throws HeadlessException {
|
|
86 |
throw new HeadlessException();
|
|
87 |
}
|
|
88 |
|
|
89 |
public Rectangle getMaximumWindowBounds() throws HeadlessException {
|
|
90 |
throw new HeadlessException();
|
|
91 |
}
|
|
92 |
|
|
93 |
public Graphics2D createGraphics(BufferedImage img) {
|
|
94 |
return ge.createGraphics(img); }
|
|
95 |
|
|
96 |
public Font[] getAllFonts() { return ge.getAllFonts(); }
|
|
97 |
|
|
98 |
public String[] getAvailableFontFamilyNames() {
|
|
99 |
return ge.getAvailableFontFamilyNames(); }
|
|
100 |
|
|
101 |
public String[] getAvailableFontFamilyNames(Locale l) {
|
|
102 |
return ge.getAvailableFontFamilyNames(l); }
|
|
103 |
|
|
104 |
public FontConfiguration getFontConfiguration() {
|
|
105 |
if (fontSupport != null) {
|
|
106 |
return fontSupport.getFontConfiguration();
|
|
107 |
}
|
|
108 |
return null;
|
|
109 |
}
|
|
110 |
|
|
111 |
/* Used by FontManager : internal API */
|
|
112 |
public GraphicsEnvironment getSunGraphicsEnvironment() {
|
|
113 |
return ge;
|
|
114 |
}
|
|
115 |
}
|