当前位置: 首页>>代码示例>>Java>>正文


Java GraphicsDevice.TYPE_RASTER_SCREEN属性代码示例

本文整理汇总了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;
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:bug8071705.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:PersistenceHandler.java


注:本文中的java.awt.GraphicsDevice.TYPE_RASTER_SCREEN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。