public void setScreenMode(int width, int height, boolean fullscreen) throws ServiceException {

        this.logger.logDebug(LOGGING_SOURCE, "trying to switched to " 
        		+ width + " x " + height + " (" +  windowMode(fullscreen) + ")");
		
	    // return if requested DisplayMode is already set
	    if ((Display.getDisplayMode().getWidth() == width) && 
	    		(Display.getDisplayMode().getHeight() == height) && 
	    		(Display.isFullscreen() == fullscreen)) {
	    	
		    return;
	    }
		
	    try {
			DisplayMode targetDisplayMode = findDisplayMode(width, height);
			if (targetDisplayMode == null) {
				logger.logWarning(LOGGING_SOURCE, "unable to find compatible mode for " + 
						width + " x " + height + " (" + windowMode(fullscreen) + ")");
				
				throw new ServiceException("unable to find compatible display mode for " 
						+ width + " x " + height + " (" + windowMode(fullscreen) + ")");
			}
			
	        Display.setDisplayMode(targetDisplayMode);
	        Display.setFullscreen(fullscreen);
	        
	        this.config.setWidth(targetDisplayMode.getWidth());
	        this.config.setHeight(targetDisplayMode.getHeight());
	        this.config.setFullscreen(fullscreen);
	        assert(Display.getWidth() == this.config.getWidth());
	        assert(Display.getHeight() == this.config.getHeight());
	        assert(Display.isFullscreen() == this.config.isFullscreen());
	        
	        this.logger.logInfo(LOGGING_SOURCE, "switched to " 
	        		+ targetDisplayMode + " (" 
	        		+ (fullscreen ? "fullscreen" : "windowed") + ")");
	        
		} catch (LWJGLException e) {
			throw new ServiceException("unable to switch to requested display mode " 
						+ width + " x " + height + "( " + windowMode(fullscreen) + ")", e);
		}
	}