private void _setSizeForLocation(int width, int height, @Nullable Point initial) { Point location = initial != null ? initial : getLocation(); Rectangle rect = new Rectangle(location.x, location.y, width, height); ScreenUtil.fitToScreen(rect); if (initial != null || location.x != rect.x || location.y != rect.y) { setLocation(rect.x, rect.y); } super.setSize(rect.width, rect.height); }