private void resizeIfNeeded ( ) { // resize the window if we need to int oldRenderWidth = Display . getWidth ( ) ; int oldRenderHeight = Display . getHeight ( ) ; if ( this . renderWidth == oldRenderWidth && this . renderHeight == oldRenderHeight ) return ; try { int old_x = Display . getX ( ) ; int old_y = Display . getY ( ) ; Display . setLocation ( old_x , old_y ) ; Display . setDisplayMode ( new DisplayMode ( this . renderWidth , this . renderHeight ) ) ; System . out . println ( "Resized the window" ) ; } catch ( LWJGLException e ) { System . out . println ( "Failed to resize the window!" ) ; e . printStackTrace ( ) ; } forceResize ( this . renderWidth , this . renderHeight ) ; }
Resizes the window and the Minecraft rendering if necessary . Set renderWidth and renderHeight first .