FileDocCategorySizeDatePackage
GraphicsEnvironment.javaAPI DocAndroid 1.5 API7666Wed May 06 22:41:54 BST 2009java.awt

GraphicsEnvironment

public abstract class GraphicsEnvironment extends Object
The GraphicsEnvironment class defines a collection of GraphicsDevice objects and Font objects which are available for Java application on current platform.
since
Android 1.0

Fields Summary
Constructors Summary
protected GraphicsEnvironment()
Constructor could not be used directly and should be obtained in extended classes.

    
Methods Summary
public abstract java.awt.Graphics2DcreateGraphics(java.awt.image.BufferedImage bufferedImage)
Creates the Graphics2D object for rendering to the specified BufferedImage.

param
bufferedImage the BufferedImage object.
return
the Graphics2D object which allows to render to the specified BufferedImage.

public abstract java.awt.Font[]getAllFonts()
Gets the array of all available fonts instances in this GraphicsEnviroments.

return
the array of all available fonts instances in this GraphicsEnviroments.

public abstract java.lang.String[]getAvailableFontFamilyNames()
Gets the array of all available font family names.

return
the array of all available font family names.

public abstract java.lang.String[]getAvailableFontFamilyNames(java.util.Locale locale)
Gets the array of all available font family names for the specified locale.

param
locale the Locale object which represents geographical region. The default locale is used if locale is null.
return
the array of available font family names for the specified locale.

public java.awt.PointgetCenterPoint()
Gets the Point which should defines the center of system window.

return
the Point where the system window should be centered.
throws
HeadlessException if isHeadless() method returns true.

        Rectangle mwb = getMaximumWindowBounds();
        return new Point(mwb.width >> 1, mwb.height >> 1);
    
public abstract java.awt.GraphicsDevicegetDefaultScreenDevice()
Gets the default screen device as GraphicDevice object.

return
the GraphicDevice object which represents default screen device.
throws
HeadlessException if isHeadless() returns true.

public static java.awt.GraphicsEnvironmentgetLocalGraphicsEnvironment()
Gets the local GraphicsEnvironment.

return
the local GraphicsEnvironment.

        synchronized (ContextStorage.getContextLock()) {
            if (ContextStorage.getGraphicsEnvironment() == null) {
                if (isHeadless()) {
                    ContextStorage.setGraphicsEnvironment(new HeadlessGraphicsEnvironment());
                } else {
                    CommonGraphics2DFactory g2df = (CommonGraphics2DFactory)Toolkit
                            .getDefaultToolkit().getGraphicsFactory();

                    ContextStorage.setGraphicsEnvironment(g2df
                            .createGraphicsEnvironment(ContextStorage.getWindowFactory()));
                }
            }

            return ContextStorage.getGraphicsEnvironment();
        }
    
public java.awt.RectanglegetMaximumWindowBounds()
Gets the maximum bounds of system centered windows.

return
the maximum bounds of system centered windows.
throws
HeadlessException if isHeadless() method returns true.

        return getDefaultScreenDevice().getDefaultConfiguration().getBounds();
    
public abstract java.awt.GraphicsDevice[]getScreenDevices()
Gets an array of all available screen devices.

return
the array of GraphicsDevice objects which represents all available screen devices.
throws
HeadlessException if isHeadless() returns true.

public static booleanisHeadless()
Checks whether or not a display, keyboard, and mouse are supported in this environment.

return
true, if a HeadlessException is thrown from areas of the Toolkit and GraphicsEnvironment that are dependent on a display, keyboard, or mouse, false otherwise.

        return "true".equals(System.getProperty("java.awt.headless"));
    
public booleanisHeadlessInstance()
Returns whether or not a display, keyboard, and mouse are supported in this graphics environment.

return
true, if HeadlessException will be thrown from areas of the graphics environment that are dependent on a display, keyboard, or mouse, false otherwise.

        return false;
    
public voidpreferLocaleFonts()
Indicates that the primary font should be used. Primary font is specified by initial system locale or default encoding).

        // Note: API specification says following:
        // "The actual change in font rendering behavior resulting
        // from a call to this method is implementation dependent;
        // it may have no effect at all." So, doing nothing is an
        // acceptable behavior for this method.

        // For now FontManager uses 1.4 font.properties scheme for font mapping,
        // so
        // this method doesn't make any sense. The implementation of this method
        // which will influence font mapping is postponed until
        // 1.5 mapping scheme not implemented.

        // todo - Implement non-default behavior with 1.5 font mapping scheme
    
public voidpreferProportionalFonts()
Indicates that a proportional preference of the font should be used.

        // Note: API specification says following:
        // "The actual change in font rendering behavior resulting
        // from a call to this method is implementation dependent;
        // it may have no effect at all." So, doing nothing is an
        // acceptable behavior for this method.

        // For now FontManager uses 1.4 font.properties scheme for font mapping,
        // so
        // this method doesn't make any sense. The implementation of this method
        // which will influence font mapping is postponed until
        // 1.5 mapping scheme not implemented.

        // todo - Implement non-default behavior with 1.5 font mapping scheme