void (Dimension size) { //todo: consider changing only the caption panel minimum size Dimension sizeFromHeader = calcHeaderSize(); if (size == null) { myMinSize = sizeFromHeader; } else { final int width = Math.max(size.width, sizeFromHeader.width); final int height = Math.max(size.height, sizeFromHeader.height); myMinSize = new Dimension(width, height); } if (myWindow != null) { Rectangle screenRectangle = ScreenUtil.getScreenRectangle(myWindow.getLocation()); int width = Math.min(screenRectangle.width, myMinSize.width); int height = Math.min(screenRectangle.height, myMinSize.height); myWindow.setMinimumSize(new Dimension(width, height)); } }