Heisenberg has said that the position and velocity of a small object cannot be known 100% accurate. Now, suppose I take a big metal box within which there is only one electron (somehow). I don't know the position of the electron in space nor do I know its velocity. Now suppose I'm compressing the box from all sides uniformly, keeping all physical quantities constant. The vertices of the cube were already noted before compressing it. Now as the cube is compressed from all sides equally the vertices are also noted down in such a manner that one of the vertices remains as the origin $(0,0,0)$. Now as the cube is compressed on and on, the specific region of space within which the electron is located is known with certainty. The cube is compressed until the electron just fits the cube. Correct me if I'm wrong. Is this against Heisenberg's Principle?
The wikipedia article for Particle in a Box neatly explains how it obeys the uncertainty principle. Basically, a smaller box gives the particle a wider distribution of momentum, or more uncertainty in momentum.