private static int calcWidthToFitText(@NotNull JTextField textField, @NotNull String text, int additionalWidth) {
    return textField.getFontMetrics(textField.getFont()).stringWidth(text) + additionalWidth;
  }
private static int calcWidthToFitText(@NotNull JTextField textField, @NotNull String text, int additionalWidth)