int (JComponent component) { if (component.getBorder() != null) { return component.getBorder().getBorderInsets(component).left; } JComponent wrapped = (JComponent)ContainerUtil.find(component.getComponents(), co -> co.isVisible()); return wrapped != null ? getLeftInset(wrapped) : 0; }