@Override
  public Insets getBorderInsets(Component c) {
    if (ComponentUtil.getParentOfType(CellRendererPane.class, c) != null) {
      return JBInsets.emptyInsets().asUIResource();
    }
    Insets result = UIManager.getInsets(borderWidthPropertyName());
    if (result == null) {
      return JBUI.insets(1);
    }

    if (c instanceof AbstractButton button && !Strings.isNullOrEmpty(button.getText())) {
      if (result instanceof JBInsets jbInsets) {
        Insets unscaled = jbInsets.getUnscaled();
        result = new JBInsets(unscaled.top, unscaled.left, unscaled.bottom, 0);
      }
      else {
        //noinspection UseDPIAwareInsets
        result = new Insets(result.top, result.left, result.bottom, 0);
      }
    }
    return result;
  }
@Override
  public Insets getBorderInsets(Component c)