當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。