private void removeItem(Object obj, Field field, int index) {
    final JScrollBar sb = genericTagPropertiesEditPanelScrollPanel.getVerticalScrollBar();
    final int val = sb.getValue(); // save scroll top
    SWFType swfType = field.getAnnotation(SWFType.class);
    if (swfType != null
        && !swfType
            .countField()
            .isEmpty()) { // Fields with same countField must be removed from too
      Field[] fields = obj.getClass().getDeclaredFields();
      for (int f = 0; f < fields.length; f++) {
        SWFType fieldSwfType = fields[f].getAnnotation(SWFType.class);
        if (fieldSwfType != null && fieldSwfType.countField().equals(swfType.countField())) {
          ReflectionTools.removeFromField(obj, fields[f], index);
        }
      }
      try {
        // If countField exists, decrement, otherwise do nothing
        Field countField = obj.getClass().getDeclaredField(swfType.countField());
        int cnt = countField.getInt(obj);
        cnt--;
        countField.setInt(obj, cnt);
      } catch (NoSuchFieldException
          | SecurityException
          | IllegalArgumentException
          | IllegalAccessException ex) {
        // ignored
      }
    } else {
      ReflectionTools.removeFromField(obj, field, index);
    }

    generateEditControls(editedTag, false);

    // Restore scroll top after some time. TODO: Handle this better. I don't know how :-(.
    new Thread() {

      @Override
      public void run() {
        try {
          Thread.sleep(500);
        } catch (InterruptedException ex) {
          logger.log(Level.SEVERE, null, ex);
        }

        View.execInEventDispatch(
            () -> {
              genericTagPropertiesEditPanelScrollPanel.getVerticalScrollBar().setValue(val);
            });
      }
    }.start();
    revalidate();
    repaint();
  }
 public String swfTypeToString(SWFType swfType) {
   if (swfType == null) {
     return null;
   }
   String result = swfType.value().toString();
   if (swfType.count() > 0) {
     result += "[" + swfType.count();
     if (swfType.countAdd() > 0) {
       result += " + " + swfType.countAdd();
     }
     result += "]";
   } else if (!swfType.countField().isEmpty()) {
     result += "[" + swfType.countField();
     if (swfType.countAdd() > 0) {
       result += " + " + swfType.countAdd();
     }
     result += "]";
   }
   return result;
 }