public boolean displayModesMatch(DisplayMode mode1,
        DisplayMode mode2){
        if(mode == Display.FULLSCREEN){
            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;
        }
        return false;
    }