| java.lang.Object java.awt.GraphicsConfiguration
All known Subclasses: java.awt.QtGraphicsConfiguration, java.awt.MWGraphicsConfiguration, sun.awt.qt.QtGraphicsConfiguration, sun.awt.gtk.GdkGraphicsConfiguration, sun.awt.pocketpc.PPCGraphicsConfiguration, java.awt.X11GraphicsConfig,
GraphicsConfiguration | abstract public class GraphicsConfiguration (Code) | | The GraphicsConfiguration class describes the
characteristics of a graphics destination such as a printer or monitor.
There can be many GraphicsConfiguration objects associated
with a single graphics device, representing different drawing modes or
capabilities. The corresponding native structure will vary from platform
to platform. For example, on X11 windowing systems,
each visual is a different GraphicsConfiguration .
On win32, GraphicsConfiguration s represent PixelFormats
available in the current resolution and color depth.
In a virtual device multi-screen environment in which the desktop
area could span multiple physical screen devices, the bounds of the
GraphicsConfiguration objects are relative to the
virtual coordinate system. When setting the location of a
component, use
GraphicsConfiguration.getBounds() getBounds to get the bounds of
the desired GraphicsConfiguration and offset the location
with the coordinates of the GraphicsConfiguration ,
as the following code sample illustrates:
Frame f = new Frame(GraphicsConfiguration gc);
Rectangle bounds = gc.getBounds();
f.setLocation(10 + bounds.x, 10 + bounds.y);
To determine if your environment is a virtual device
environment, call getBounds on all of the
GraphicsConfiguration objects in your system. If
any of the origins of the returned bounds are not (0, 0),
your environment is a virtual device environment.
You can also use getBounds to determine the bounds
of the virtual device. Call getBounds on all
of the GraphicsConfiguration objects in your
system. Then, calculate the union of all of the bounds returned
from the calls to getBounds . The union is the
bounds of the virtual device. The following code sample
calculates the bounds of the virtual device.
Rectangle virtualBounds = new Rectangle();
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] gs =
ge.getScreenDevices();
for (int j = 0; j < gs.length; j++) {
GraphicsDevice gd = gs[j];
GraphicsConfiguration[] gc =
gd.getConfigurations();
for (int i=0; i < gc.length; i++) {
virtualBounds =
virtualBounds.union(gc[i].getBounds());
}
}
See Also: Window See Also: Frame See Also: GraphicsEnvironment See Also: GraphicsDevice |
Constructor Summary | |
protected | GraphicsConfiguration() This is an abstract class that cannot be instantiated directly. |
createCompatibleImage | abstract public BufferedImage createCompatibleImage(int width, int height)(Code) | | Returns a
BufferedImage with a data layout and color model
compatible with this GraphicsConfiguration . This
method has nothing to do with memory-mapping
a device. The returned BufferedImage has
a layout and color model that is closest to this native device
configuration and can therefore be optimally blitted to this
device.
Parameters: width - the width of the returned BufferedImage Parameters: height - the height of the returned BufferedImage a BufferedImage whose data layout and colormodel is compatible with this GraphicsConfiguration . |
createCompatibleVolatileImage | abstract public VolatileImage createCompatibleVolatileImage(int width, int height)(Code) | | Returns a
VolatileImage with a data layout and color model
compatible with this GraphicsConfiguration .
The returned VolatileImage
may have data that is stored optimally for the underlying graphics
device and may therefore benefit from platform-specific rendering
acceleration.
Parameters: width - the width of the returned VolatileImage Parameters: height - the height of the returned VolatileImage a VolatileImage whose data layout and colormodel is compatible with this GraphicsConfiguration . See Also: Component.createVolatileImage(intint) |
createCompatibleVolatileImage | public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException(Code) | | Returns a
VolatileImage with a data layout and color model
compatible with this GraphicsConfiguration , using
the specified image capabilities.
The returned VolatileImage has
a layout and color model that is closest to this native device
configuration and can therefore be optimally blitted to this
device.
a VolatileImage whose data layout and color model is compatible with this GraphicsConfiguration . Parameters: width - the width of the returned VolatileImage Parameters: height - the height of the returned VolatileImage Parameters: caps - the image capabilities exception: AWTException - if the supplied image capabilities could not be met by this graphics configuration since: 1.4 |
getBounds | abstract public Rectangle getBounds()(Code) | | Returns the bounds of the GraphicsConfiguration
in the device coordinates. In a multi-screen environment
with a virtual device, the bounds can have negative X
or Y origins.
the bounds of the area covered by thisGraphicsConfiguration . since: 1.3 |
getColorModel | abstract public ColorModel getColorModel()(Code) | | Returns the
ColorModel associated with this
GraphicsConfiguration .
a ColorModel object that is associated withthis GraphicsConfiguration . |
getDevice | abstract public GraphicsDevice getDevice()(Code) | | Returns the
GraphicsDevice associated with this
GraphicsConfiguration .
a GraphicsDevice object that is associated with this GraphicsConfiguration . |
|
|