void (JComponent view, Insets insets) { if (this == view.getBorder()) { JViewport viewport = ComponentUtil.getViewport(view); if (viewport != null) { JScrollPane pane = ComponentUtil.getScrollPane(viewport); if (pane != null) { boolean isOverlappingScrollBar = (pane instanceof JBScrollPane) && ((JBScrollPane)pane).isOverlappingScrollBar(); // calculate empty border under vertical scroll bar JScrollBar vsb = pane.getVerticalScrollBar(); if (vsb != null && vsb.isVisible() && !isOverlappingScrollBar) { boolean opaque = vsb.isOpaque(); if (viewport == pane.getColumnHeader() ? (!opaque || ScrollSettings.isHeaderOverCorner(pane.getViewport())) : (!opaque && viewport == pane.getViewport() && !ClientProperty.isTrue(vsb, JBScrollPane.IGNORE_SCROLLBAR_IN_INSETS))) { Alignment va = Alignment.get(vsb); if (va == Alignment.LEFT) { insets.left += vsb.getWidth(); } else if (va == Alignment.RIGHT && (opaque || isAlignmentNeeded(view, false))) { insets.right += vsb.getWidth(); } } } // calculate empty border under horizontal scroll bar JScrollBar hsb = pane.getHorizontalScrollBar(); if (hsb != null && hsb.isVisible() && !isOverlappingScrollBar) { boolean opaque = hsb.isOpaque(); if (viewport == pane.getRowHeader() ? (!opaque || ScrollSettings.isHeaderOverCorner(pane.getViewport())) : (!opaque && viewport == pane.getViewport() && !ClientProperty.isTrue(hsb, JBScrollPane.IGNORE_SCROLLBAR_IN_INSETS))) { Alignment ha = Alignment.get(hsb); if (ha == Alignment.TOP) { insets.top += hsb.getHeight(); } else if (ha == Alignment.BOTTOM && (opaque || isAlignmentNeeded(view, true))) { insets.bottom += hsb.getHeight(); } } } } } } }