how to keep world position constant, when resizing java applet?
I'm building a fairly complex application in Java, with JBox2D (actually, PBox2D, a wrapper for Processing). One component of this Java application is in Processing (PApplet), containing a JBox2D world. This is so I can use the excellent Processing drawing functions later in the life of the project.
When the applet gets resized, however, objects in the world do not respect the world boundaries, or the boundaries drift. Please see this video:
http://www.youtube.com/watch?v=z4p3olwNDPU
The boxes are where the boundaries should be... they are what is drawn in Processing. However, PBox does not maintain the same locations for its boundaries... for some reason, when the applet window changes sizes, the PBox world shifts to stick to the bottom of the window, while the Processing objects do not. Maddeningly, if I make the window bigger along the X axis, the PBox elements retain their original (correct) locations.
All of the Processing code seems functional and predictable. I cannot isolate the position changes for PBox... I'm at a loss as to what causes this, and how to fix it. My hunch is that it involves the PBox ground body, but that could be wrong.
This applet will be embedded in a Swing GUI in the future, and it misbehaves there too.
Thanks... any help is welcome.