e gc is a GraphicsConfiguration 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 is not (0, 0), your environment is a virtual device environment.
You can also use getBounds
to determine the bounds of the virtual device. To do this, first 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.
{@code 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 Window
@see Frame
@see GraphicsEnvironment
@see GraphicsDevice