Camera navigation after display resizing

Hi everybody!



I'm stuck with the following problem: I'm calling this method here with the values 500, 300, false.



public void resizeWindow(int newWidth, int newHeight, boolean centered) {
   display.recreateWindow(newWidth, newHeight, display.getBitDepth(), PropertiesGameSettings.DEFAULT_FREQUENCY, false);   

   cam.resize(display.getWidth(), display.getHeight());      
        cam.update();
      
   if (centered) {
      Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
      display.moveWindowTo(((int)dim.getWidth()/2-newWidth/2), ((int)dim.getHeight()/2)-(newHeight/2));
   }
   else
      display.moveWindowTo(newWidth+10, 15);
}



After this my window gets resized correctly and is placed in the upper right corner of my screen. That's exactly what I want. The problem occurs when I call this method the second time with the values 1024, 768, true. Now the window is centered on the screen and resized correctly, too, but my camera is rotated somehow and I can't use my FirstPersonHandler to navigate in the scene correctly. I first thought this would be because of the direction or the left-value of the camera, but they are correct. Now I think I have to tell the camera that the display has been resized somehow. But how do I do this?

Can anybody help me with this problem? Any hints?

Thanks in advance!

ALEX