public class

HeadlessGraphicsEnvironment

extends GraphicsEnvironment
implements FontSupport
java.lang.Object
   ↳ java.awt.GraphicsEnvironment
     ↳ sun.java2d.HeadlessGraphicsEnvironment

Class Overview

Headless decorator implementation of a SunGraphicsEnvironment

Summary

Public Constructors
HeadlessGraphicsEnvironment(GraphicsEnvironment ge)
Public Methods
Graphics2D createGraphics(BufferedImage img)
Returns a Graphics2D object for rendering into the specified BufferedImage.
Font[] getAllFonts()
Returns an array containing a one-point size instance of all fonts available in this GraphicsEnvironment.
String[] getAvailableFontFamilyNames(Locale l)
Returns an array containing the names of all font families in this GraphicsEnvironment localized for the specified locale.
String[] getAvailableFontFamilyNames()
Returns an array containing the names of all font families in this GraphicsEnvironment localized for the default locale, as returned by Locale.getDefault().
Point getCenterPoint()
Returns the Point where Windows should be centered.
GraphicsDevice getDefaultScreenDevice()
Returns the default screen GraphicsDevice.
FontConfiguration getFontConfiguration()
Returns the current font configuration.
Rectangle getMaximumWindowBounds()
Returns the maximum bounds for centered Windows.
GraphicsDevice[] getScreenDevices()
Returns an array of all of the screen GraphicsDevice objects.
GraphicsEnvironment getSunGraphicsEnvironment()
[Expand]
Inherited Methods
From class java.awt.GraphicsEnvironment
From class java.lang.Object
From interface sun.java2d.FontSupport

Public Constructors

public HeadlessGraphicsEnvironment (GraphicsEnvironment ge)

Public Methods

public Graphics2D createGraphics (BufferedImage img)

Returns a Graphics2D object for rendering into the specified BufferedImage.

Parameters
img the specified BufferedImage
Returns
  • a Graphics2D to be used for rendering into the specified BufferedImage

public Font[] getAllFonts ()

Returns an array containing a one-point size instance of all fonts available in this GraphicsEnvironment. 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 provides for the application the most precise control over which Font instance is used to render text. If a font in this GraphicsEnvironment has multiple programmable variations, only one instance of that Font is returned in the array, and other variations must be derived by the application.

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. The other variations must be derived by the application.

Returns
  • an array of Font objects

public String[] getAvailableFontFamilyNames (Locale l)

Returns an array containing the names of all font families in this GraphicsEnvironment localized for the specified locale.

Typical usage would be for presentation to a user for selection of a particular family name. An application can then specify this name when creating a font, in conjunction with a style, such as bold or italic, giving the font system flexibility in choosing its own best match among multiple fonts in the same font family.

Parameters
l a Locale object that represents a particular geographical, political, or cultural region. Specifying null is equivalent to specifying Locale.getDefault().
Returns
  • an array of String containing font family names localized for the specified Locale, or a suitable alternative name if no name exists for the specified locale.

public String[] getAvailableFontFamilyNames ()

Returns an array containing the names of all font families in this GraphicsEnvironment localized for the default locale, as returned by Locale.getDefault().

Typical usage would be for presentation to a user for selection of a particular family name. An application can then specify this name when creating a font, in conjunction with a style, such as bold or italic, giving the font system flexibility in choosing its own best match among multiple fonts in the same font family.

Returns
  • an array of String containing font family names localized for the default locale, or a suitable alternative name if no name exists for this locale.

public Point getCenterPoint ()

Returns the Point where Windows should be centered. It is recommended that centered Windows be checked to ensure they fit within the available display area using getMaximumWindowBounds().

Returns
  • the point where Windows should be centered

public GraphicsDevice getDefaultScreenDevice ()

Returns the default screen GraphicsDevice.

Returns
  • the GraphicsDevice that represents the default screen device

public FontConfiguration getFontConfiguration ()

Returns the current font configuration.

public Rectangle getMaximumWindowBounds ()

Returns the maximum bounds for centered Windows. These bounds account for objects in the native windowing system such as task bars and menu bars. The returned bounds will reside on a single display with one exception: on multi-screen systems where Windows should be centered across all displays, this method returns the bounds of the entire display area.

To get the usable bounds of a single display, use GraphicsConfiguration.getBounds() and Toolkit.getScreenInsets().

Returns
  • the maximum bounds for centered Windows

public GraphicsDevice[] getScreenDevices ()

Returns an array of all of the screen GraphicsDevice objects.

Returns
  • an array containing all the GraphicsDevice objects that represent screen devices

public GraphicsEnvironment getSunGraphicsEnvironment ()