Centering content causing both vertical/horiztonal scrollbars (sometimes)

My goal is to create a login panel which centers on the screen but even with the simple demo below I noticed that extra vertical and horizontal scrollbars show up sometimes. If I resize the browser window sometimes they disappear too. I’m guessing maybe its due to rounding error in the layout maybe.

Is there a bullet proof way to do this so it works w/o scrollbars showing up?


public class Demo extends Application {
	public void init() {
		final Window mainWindow = new Window();
	private ComponentContainer createContent() {
		final VerticalLayout content = new VerticalLayout();
		final Label label = new Label("TEST");
		label.setWidth(200, Sizeable.UNITS_PIXELS);
		content.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
		return content;

Oops. I didn’t realize that I had zoomed in with the browser magnifier a few times. Of course it would be nice if the scrollbars still didn’t show up but it’s less of an issue now.

I also forgot to mention this was running on Vaadin 6.8.12.