⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e604. getting the current screen refresh rate and number of colors.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
This example retrieves the refresh rate (in Hz) and number of supported colors for all screens. 
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    
    for (int i=0; i<gs.length; i++) {
        DisplayMode dm = gs[i].getDisplayMode();
    
        // Get refresh rate in Hz
        int refreshRate = dm.getRefreshRate();
        if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) {
            // Unknown rate
        }
    
        // Get number of colors
        int bitDepth = dm.getBitDepth();
        if (bitDepth == DisplayMode.BIT_DEPTH_MULTI) {
            // Multiple bit depths are supported in this display mode
        } else {
            int numColors = (int)Math.pow(2, bitDepth);
        }
    }

 Related Examples 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -