Example usage for java.awt DisplayMode BIT_DEPTH_MULTI

List of usage examples for java.awt DisplayMode BIT_DEPTH_MULTI

Introduction

In this page you can find the example usage for java.awt DisplayMode BIT_DEPTH_MULTI.

Prototype

int BIT_DEPTH_MULTI

To view the source code for java.awt DisplayMode BIT_DEPTH_MULTI.

Click Source Link

Document

Value of the bit depth if multiple bit depths are supported in this display mode.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();

    DisplayMode[] dmodes = gs.getDisplayModes();
    for (int i = 0; i < dmodes.length; i++) {
        DisplayMode dm = dmodes[i];
        if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) {
            System.out.println("DisplayMode.BIT_DEPTH_MULTI");
        }/*from w  w w. j a va 2 s  .  c  o  m*/
    }
}

From source file:DisplayModeModel.java

public Object getValueAt(int rowIndex, int colIndex) {
    DisplayMode dm = modes[rowIndex];
    switch (colIndex) {
    case DisplayModeTest.INDEX_WIDTH:
        return Integer.toString(dm.getWidth());
    case DisplayModeTest.INDEX_HEIGHT:
        return Integer.toString(dm.getHeight());
    case DisplayModeTest.INDEX_BITDEPTH: {
        int bitDepth = dm.getBitDepth();
        String ret;/*from w w  w. j a  va2  s  .  c  o  m*/
        if (bitDepth == DisplayMode.BIT_DEPTH_MULTI) {
            ret = "Multi";
        } else {
            ret = Integer.toString(bitDepth);
        }
        return ret;
    }
    case DisplayModeTest.INDEX_REFRESHRATE: {
        int refreshRate = dm.getRefreshRate();
        String ret;
        if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) {
            ret = "Unknown";
        } else {
            ret = Integer.toString(refreshRate);
        }
        return ret;
    }
    }
    throw new ArrayIndexOutOfBoundsException("Invalid column value");
}

From source file:DisplayModeModel.java

public void setDMLabel(DisplayMode newMode) {
    int bitDepth = newMode.getBitDepth();
    int refreshRate = newMode.getRefreshRate();
    String bd, rr;/*from  w w w . ja v a  2s. c o  m*/
    if (bitDepth == DisplayMode.BIT_DEPTH_MULTI) {
        bd = "Multi";
    } else {
        bd = Integer.toString(bitDepth);
    }
    if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) {
        rr = "Unknown";
    } else {
        rr = Integer.toString(refreshRate);
    }
    currentDM.setText(COLUMN_NAMES[INDEX_WIDTH] + ": " + newMode.getWidth() + " " + COLUMN_NAMES[INDEX_HEIGHT]
            + ": " + newMode.getHeight() + " " + COLUMN_NAMES[INDEX_BITDEPTH] + ": " + bd + " "
            + COLUMN_NAMES[INDEX_REFRESHRATE] + ": " + rr);
}

From source file:Filter3dTest.java

/**
 * Determines if two display modes "match". Two display modes match if they
 * have the same resolution, bit depth, and refresh rate. The bit depth is
 * ignored if one of the modes has a bit depth of
 * DisplayMode.BIT_DEPTH_MULTI. Likewise, the refresh rate is ignored if one
 * of the modes has a refresh rate of DisplayMode.REFRESH_RATE_UNKNOWN.
 *///from w  w w  .  j  av  a 2 s .  c om
public boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2)

{
    if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()) {
        return false;
    }

    if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI
            && mode1.getBitDepth() != mode2.getBitDepth()) {
        return false;
    }

    if (mode1.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN
            && mode2.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN
            && mode1.getRefreshRate() != mode2.getRefreshRate()) {
        return false;
    }

    return true;
}