code-tutorial.com

The best resources for developers

Is it possible to get the maximum supported resolution of a connected display in os x from java?

    GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment()
        .getScreenDevices();
    for (int i = 0; i < devices.length; i++) {
        GraphicsDevice dev = devices[i];
        System.out.println("device " + i);
        DisplayMode[] modes = dev.getDisplayModes();
        for (int j = 0; j < modes.length; j++) {
            DisplayMode m = modes[j];
            System.out.println(" " + j + ": " + m.getWidth() + " x " + m.getHeight());
        }
    }

Tags: java macos resolutions osx-leopard

Source: By Paul Wicks as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0


Related code-snippets: