java.lang.Object | +--java.awt.GraphicsEnvironment
Unsafe:
The GraphicsEnvironment class describes the collection
of GraphicsDevice objects and java.awt.Font objects
available to a Java(tm) application on a particular platform.
The resources in this GraphicsEnvironment might be local
or on a remote machine. GraphicsDevice objects can be
screens, printers or image buffers and are the destination of
Graphics2D drawing methods. Each GraphicsDevice
has a number of GraphicsConfiguration objects associated with
it. These objects specify the different configurations in which the
GraphicsDevice can be used.
GraphicsDevice,
GraphicsConfiguration(package private) static void
checkHeadless()
abstract Graphics2D
createGraphics(java.awt.image.BufferedImage img)
Graphics2D object for rendering into the
specified BufferedImage.
abstract Font[]
getAllFonts()
GraphicsEnvironment.
abstract String[]
getAvailableFontFamilyNames()
GraphicsEnvironment.
abstract String[]
getAvailableFontFamilyNames(Locale l)
GraphicsEnvironment.
abstract GraphicsDevice
getDefaultScreenDevice()
GraphicsDevice.
static GraphicsEnvironment
getLocalGraphicsEnvironment()
GraphicsEnvironment.
abstract GraphicsDevice[]
getScreenDevices()
GraphicsDevice
objects.
static boolean
isHeadless()
boolean
isHeadlessInstance()
private static GraphicsEnvironment localEnv
private static Boolean headless
protected GraphicsEnvironment()
public static GraphicsEnvironment getLocalGraphicsEnvironment()
GraphicsEnvironment.
GraphicsEnvironmentpublic static boolean isHeadless()
true if this environment cannot support
a display, keyboard, and mouse; false
otherwisejava.awt.HeadlessExceptionprivate static boolean getHeadlessProperty()
static void checkHeadless() throws HeadlessException
HeadlessExceptionpublic boolean isHeadlessInstance()
HeadlessException will be thrown from areas of the
graphics environment that are dependent on a display, keyboard, or
mouse.
true if a display, keyboard, and mouse
can be supported in this environment; false
otherwisejava.awt.HeadlessException,
isHeadless()public abstract GraphicsDevice[] getScreenDevices() throws HeadlessException
GraphicsDevice
objects.
GraphicsDevice
objects that represent screen devices
HeadlessExceptionisHeadlesspublic abstract GraphicsDevice getDefaultScreenDevice() throws HeadlessException
GraphicsDevice.
GraphicsDevice that represents the
default screen device
HeadlessExceptionisHeadlesspublic abstract Graphics2D createGraphics(java.awt.image.BufferedImage img)
Graphics2D object for rendering into the
specified BufferedImage.
img - the specified BufferedImage
Graphics2D to be used for rendering into
the specified BufferedImagepublic abstract Font[] getAllFonts()
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.
Font objectsgetAvailableFontFamilyNames(),
java.awt.Font,
java.awt.Font#deriveFont,
java.awt.Font#getFontNamepublic abstract String[] getAvailableFontFamilyNames()
GraphicsEnvironment.
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 style attributes such
as Bold or Italic.
This method provides for the application some control over which
Font instance is 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.
String containing names of font
familiesgetAllFonts(),
java.awt.Font,
java.awt.Font#getFamilypublic abstract String[] getAvailableFontFamilyNames(Locale l)
GraphicsEnvironment.
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 style attributes such
as Bold or Italic.
This method provides for the application some control over which
Font instance 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.
If l is null, this method returns an
array containing all font family names available in this
GraphicsEnvironment.
l - a Locale object that represents a
particular geographical, political, or cultural region
String objects containing names of
font families specific to the specified LocalegetAllFonts(),
java.awt.Font,
java.awt.Font#getFamilypublic Point getCenterPoint() throws HeadlessException
HeadlessExceptiongetMaximumWindowBounds()public Rectangle getMaximumWindowBounds() throws HeadlessException
To get the usable bounds of a single display, use
GraphicsConfiguration.getBounds() and
Toolkit.getScreenInsets().
HeadlessExceptiongetCenterPoint(),
GraphicsConfiguration.getBounds(),
Toolkit.getScreenInsets(java.awt.GraphicsConfiguration)