1 /*
   2  * Copyright (c) 2000, 2005, Oracle and/or its affiliates. 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * 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 
  64     private GraphicsEnvironment ge;
  65 
  66     public HeadlessGraphicsEnvironment(GraphicsEnvironment ge) {
  67         this.ge = ge;
  68     }
  69 
  70     public GraphicsDevice[] getScreenDevices()
  71         throws HeadlessException {
  72         throw new HeadlessException();
  73     }
  74 
  75     public GraphicsDevice getDefaultScreenDevice()
  76         throws HeadlessException {
  77         throw new HeadlessException();
  78     }
  79 
  80     public Point getCenterPoint() throws HeadlessException {
  81         throw new HeadlessException();
  82     }
  83 
  84     public Rectangle getMaximumWindowBounds() throws HeadlessException {
  85         throw new HeadlessException();
  86     }
  87 
  88     public Graphics2D createGraphics(BufferedImage img) {
  89         return ge.createGraphics(img); }
  90 
  91     public Font[] getAllFonts() { return ge.getAllFonts(); }
  92 
  93     public String[] getAvailableFontFamilyNames() {
  94         return ge.getAvailableFontFamilyNames(); }
  95 
  96     public String[] getAvailableFontFamilyNames(Locale l) {
  97         return ge.getAvailableFontFamilyNames(l); }
  98 
  99     /* Used by FontManager : internal API */
 100     public GraphicsEnvironment getSunGraphicsEnvironment() {
 101         return ge;
 102     }
 103 }