Rectangle (@NotNull JTable table, @NotNull Point point, int width, int minHeight, int modelRows, boolean showCodePreview) { boolean addExtraSpace = Registry.is("ide.preferred.scrollable.viewport.extra.space"); int visibleRows = Math.min(showCodePreview ? 20 : 30, modelRows); int rowHeight = table.getRowHeight(); int space = addExtraSpace && visibleRows < modelRows ? rowHeight / 2 : 0; int height = visibleRows * rowHeight + minHeight + space; if (ExperimentalUI.isNewUI() && space == 0 && visibleRows == modelRows) { height += JBUIScale.scale(4); } Rectangle bounds = new Rectangle(point.x, point.y, width, height); ScreenUtil.fitToScreen(bounds); if (bounds.height != height) { minHeight += addExtraSpace && space == 0 ? rowHeight / 2 : space; bounds.height = Math.max(1, (bounds.height - minHeight) / rowHeight) * rowHeight + minHeight; } return bounds; }