Insets (JComponent view) { Border border = view.getBorder(); if (border instanceof ViewBorder vb) { Insets insets = JBInsets.emptyInsets(); vb.addViewInsets(view, insets); return insets; } return null; }