# libGdx Window .pack() not working

I'm trying to make a window, then use the pack method to get the right size, but the window maximizes instead. Here's my code:

private Table buildOptionsWindowLayer() {
winOptions = new Window("Options", skinLibgdx);
// (...) building some widgets

Gdx.app.log(TAG, "pref width is " + winOptions.getPrefWidth());
// displays: "pref width is 247.0"

winOptions.pack();

// move the window
winOptions.setPosition(Constants.VIEWPORT_GUI_HEIGHT - winOptions.getWidth() - 50, 50);
return winOptions;
}


The window ends up with a width of 800.0f. Why?

What it is supposed to render:

What it does render:

• Did you ever get this working? Have the same issue where I expect pack() to wrap my window around my widgets, but the window stays maximised by default. (Sorry, unable to add a comment due to just signing up) – Nelson Nov 11 '17 at 16:08