@Override
    public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
      if (index == -1 && value instanceof String stringValue && !isValid()) {
        int minLength = getMinLength();

        if (getSize().width == 0) {
          if (stringValue.length() > minLength) {
            @SuppressWarnings("unchecked") E e = (E)stringValue.substring(0, minLength);
            value = e;
          }
        }
      }

      return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    }
@Override
    public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus)