Java Platform 1.2
Beta 4

Class java.awt.GraphicsEnvironment

java.lang.Object
  |
  +--java.awt.GraphicsEnvironment

public abstract class GraphicsEnvironment
extends Object
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 Also:
GraphicsDevice, GraphicsConfiguration

Constructor Summary
GraphicsEnvironment()
           
 
Method Summary
abstract  Graphics2D createGraphics(BufferedImage img)
          Returns a Graphics2D object for rendering into the given BufferedImage.
abstract  Font[] getAllFonts()
          Returns an array containing a one-point size instance of all fonts available in this environment.
abstract  String[] getAvailableFontFamilyNames()
          Returns an array containing the names of all font families available in this environment.
abstract  String[] getAvailableFontFamilyNames(Locale l)
          Returns an array containing the localized names of all font families available in this environment.
abstract  GraphicsDevice getDefaultScreenDevice()
          Returns the default screen graphics device.
abstract  Font[] getFonts(Map attributes)
          Returns an array containing a instances of all fonts available in this environment which match the attributes specified in the Map.
static GraphicsEnvironment getLocalGraphicsEnvironment()
          Returns the local graphics environment.
abstract  GraphicsDevice[] getScreenDevices()
          Returns an array of all of the screen devices.
abstract  boolean registerFont(byte[] fontData)
          Allows an application to provide additional fonts for use in rendering.
 
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

Constructor Detail

GraphicsEnvironment

protected GraphicsEnvironment()
Method Detail

getLocalGraphicsEnvironment

public static GraphicsEnvironment getLocalGraphicsEnvironment()
Returns the local graphics environment.

getScreenDevices

public abstract GraphicsDevice[] getScreenDevices()
Returns an array of all of the screen devices.

getDefaultScreenDevice

public abstract GraphicsDevice getDefaultScreenDevice()
Returns the default screen graphics device.

createGraphics

public abstract Graphics2D createGraphics(BufferedImage img)
Returns a Graphics2D object for rendering into the given BufferedImage.

getAllFonts

public abstract Font[] getAllFonts()
Returns an array containing a one-point size instance of all fonts available in this environment. Typical usage would be to allow a user to select a particular font, then the application can size the font and set various font attributes by calling the deriveFont method on the choosen instance. This method gives the application the most precise control over which font instance will be used to render text. If a font in this environment has multiple programmable variations, such as Multiple-Master fonts, only one instance of that font is returned in the Font array, and other variations must be derived by the application.
Returns:
an array of Font objects
Since:
JDK 1.2
See Also:
getFonts(java.util.Map), getAvailableFontFamilyNames(), Font, Font.deriveFont(int, float), Font.getFontName(), MultipleMaster.deriveMMFont(float[])

getFonts

public abstract Font[] getFonts(Map attributes)
Returns an array containing a instances of all fonts available in this environment which match the attributes specified in the Map. If a size attribute is not specified in the Map, a one-point size instance will be returned for any matching fonts. The returned value may be null if no fonts in this environment match the specified attributes. Typical usage would be to allow a user to select a particular font, then the application can size the font and set various font attributes by calling the deriveFont method on the choosen instance. This method gives the application good control over which which font instance will be used to render text, but it lacks the ability to choose the "closest" matching font to the specified attributes.
Returns:
an array of Font objects
Since:
JDK 1.2
See Also:
getAllFonts(), getAvailableFontFamilyNames(), Font, Font.deriveFont(int, float), Font.getFontName()

getAvailableFontFamilyNames

public abstract String[] getAvailableFontFamilyNames()
Returns an array containing the names of all font families available in this environment. Typical usage would be to allow a user to select a particular family name and allow the application to choose related variants of the same family when the user specifies various style attributes such as Bold or Italic. This method gives the application some control over which which font instance will be used to render text, but allows the Font object more flexibility in choosing its own best match among multiple fonts in the same font family.
Returns:
an array of string containing names of font families
Since:
JDK 1.2
See Also:
getAllFonts(), getFonts(java.util.Map), Font, Font.getFamily()

registerFont

public abstract boolean registerFont(byte[] fontData)
Allows an application to provide additional fonts for use in rendering. If registration is sucessful, an instance of the font will be available from getAllFonts and other methods which can create fonts.

Parameters:
fontData - - source of font data.
Returns:
True if registration is successful.
Since:
JDK 1.2
See Also:
java.awt.io.InputStream, getAllFonts(), getAvailableFontFamilyNames(), Font

getAvailableFontFamilyNames

public abstract String[] getAvailableFontFamilyNames(Locale l)
Returns an array containing the localized names of all font families available in this environment. Typical usage would be to allow a user to select a particular family name and allow the application to choose related variants of the same family when the user specifies various style attributes such as Bold or Italic. This method gives the application some control over which which font instance will be used to render text, but allows the Font object more flexibility in choosing its own best match among multiple fonts in the same font family.
Returns:
an array of string containing names of font families
Since:
JDK 1.2
See Also:
getAllFonts(), getFonts(java.util.Map), Font, java.awt.Font#getFontFamilyName

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.