home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 3.4 KB | 119 lines |
- /*
- * @(#)GraphicsEnvironment.java 1.19 98/03/18
- *
- * Copyright 1997, 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
-
- package java.awt;
-
- import java.awt.font.TextAttributeSet;
- import java.awt.image.BufferedImage;
- import java.awt.image.ImagingLib;
- import java.awt.print.PrinterJob;
- import java.util.Hashtable;
-
- /**
- *
- * This class specifies the graphics environment. The resources in
- * this environment
- * might be local or on a remote machine. The graphics environment
- * consists of a number of GraphicsDevice objects and Font objects.
- * GraphicsDevice objects are typically screens or printers and are
- * the destination of Graphics2D drawing methods. Each GraphicsDevice
- * has a number of GraphicsConfiguration objects associated with it.
- * These specify the different configurations in which the GraphicsDevice
- * can be used.
- *
- * @see GraphicsDevice
- * @see GraphicsConfiguration
- * @version 10 Feb 1997
- */
-
- public abstract class GraphicsEnvironment {
- private static GraphicsEnvironment localEnv;
-
- protected GraphicsEnvironment() {
- }
-
- /**
- * Returns the local graphics environment.
- */
- public static GraphicsEnvironment getLocalGraphicsEnvironment() {
- if (localEnv == null) {
- String nm = System.getProperty("java.awt.graphicsenv", null);
-
- try {
- localEnv =
- (GraphicsEnvironment) Class.forName(nm).newInstance();
- } catch (ClassNotFoundException e) {
- throw new Error("Could not find class: "+nm);
- } catch (InstantiationException e) {
- throw new Error("Could not instantiate Graphics Environment: "
- + nm);
- } catch (IllegalAccessException e) {
- throw new Error ("Could not access Graphics Environment: "
- + nm);
- }
- }
-
- return localEnv;
- }
-
- /**
- * Returns an array of all of the screen devices.
- */
- public abstract GraphicsDevice[] getScreenDevices();
-
- /**
- * Returns the default screen graphics device.
- */
- public abstract GraphicsDevice getDefaultScreenDevice();
-
- /**
- * Returns a Graphics2D object for rendering into the
- * given BufferedImage.
- */
- public abstract Graphics2D createGraphics(BufferedImage img);
-
- /**
- * Returns a ImagingLib object that can used to process
- * some/all of the imaging ops. Can be null.
- */
- public abstract ImagingLib getImagingLib();
-
- /**
- * Returns all fonts available in this environment.
- */
- public abstract Font[] getAllFonts();
-
- /**
- * Returns all Fonts available in this environment that match
- * the specified AttributeSet.
- */
- public abstract Font[] getFonts (TextAttributeSet attributes);
-
- /* this is in place of the above function and will eventually merge
- * using FontFeatureSet mechanism
- */
- public abstract Font getFont(String fontFaceName);
-
- /**
- * Gets a <code>PrinterJob</code> object suitable for the
- * the current platform.
- * @return a <code>PrinterJob</code> object.
- * @see java.awt.PrinterJob
- * @since JDK1.2
- */
- public abstract PrinterJob getPrinterJob();
- }
-
-