public static void replaceText(JComponent component) {
    for (Component child : UIUtil.uiTraverser(component)) {
      if (child instanceof JLabel label) {
        String oldText = label.getText();
        if (oldText != null) {
          label.setText(doReplace(oldText));
        }
      }
      else if (child instanceof AbstractButton button) {
        String oldText = button.getText();
        if (oldText != null) {
          button.setText(doReplace(oldText));
        }
      }
    }
  }
public static void replaceText(JComponent component)