本文整理匯總了Java中java.awt.GraphicsDevice.TYPE_RASTER_SCREEN屬性的典型用法代碼示例。如果您正苦於以下問題:Java GraphicsDevice.TYPE_RASTER_SCREEN屬性的具體用法?Java GraphicsDevice.TYPE_RASTER_SCREEN怎麽用?Java GraphicsDevice.TYPE_RASTER_SCREEN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.GraphicsDevice
的用法示例。
在下文中一共展示了GraphicsDevice.TYPE_RASTER_SCREEN屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkConfigs
private static GraphicsDevice checkConfigs(GraphicsDevice[] devices) {
GraphicsDevice correctDevice = null;
if (devices.length < 2) {
return correctDevice;
}
Toolkit toolkit = Toolkit.getDefaultToolkit();
Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
int halfScreen = screenBounds.height/2;
for(int i = 0; i < devices.length; i++) {
if(devices[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
GraphicsConfiguration conf =
devices[i].getDefaultConfiguration();
Rectangle bounds = conf.getBounds();
if (bounds.y >= halfScreen) {
// found
correctDevice = devices[i];
break;
}
}
}
return correctDevice;
}
示例2: isOutOfScreen
/**
* @return False if the given point is not inside any screen device that are currently available.
*/
private static boolean isOutOfScreen( int x, int y ) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for( int j=0; j<gs.length; j++ ) {
GraphicsDevice gd = gs[j];
if( gd.getType() != GraphicsDevice.TYPE_RASTER_SCREEN )
continue;
Rectangle bounds = gd.getDefaultConfiguration().getBounds();
if( bounds.contains( x, y ) )
return false;
}
return true;
}