public static void enforce(Window window) {
		Dimension origSize = window.getSize();
		Dimension otherSize = window.getMinimumSize();
		int width = origSize.width;
		int height = origSize.height;

		if (width < otherSize.width) {
			width = otherSize.width;
		}
		if (height < otherSize.height) {
			height = otherSize.height;
		}
		otherSize = window.getMaximumSize();
		if (width > otherSize.width) {
			width = otherSize.width;
		}
		if (height > otherSize.height) {
			height = otherSize.height;
		}
		if (width != origSize.width || height != origSize.height) {
			window.setSize(width, height);
		}
	}