code: public void closeOnEscape () {
  		addListener(new InputListener() {
  			@Override
  			public boolean keyDown (InputEvent event, int keycode) {
  				if (keycode == Keys.ESCAPE) {
  					close();
  					return true;
  				}
  
  				return false;
  			}
  
  			@Override
  			public boolean keyUp (InputEvent event, int keycode) {
  				if (keycode == Keys.BACK) {
  					close();
  					return true;
  				}
  
  				return false;
  			}
  		});
  	}
docs: Will make this window close when escape key or back key was pressed. After pressing escape or back, {@link #close()} is called.
  Back key is Android and iOS only