public NavBarItem(NavBarPanel panel, Object object, int idx, Disposable parent) {
    // count++;
    // System.out.println(count);
    myPanel = panel;
    myUI = panel.getNavBarUI();
    myObject = object;
    myIndex = idx;
    isPopupElement = idx == -1;
    if (object != null) {
      final NavBarPresentation presentation = myPanel.getPresentation();
      myText = presentation.getPresentableText(object);
      Icon icon = presentation.getIcon(object);
      myIcon = icon != null ? icon : EmptyIcon.create(5);
      myAttributes = presentation.getTextAttributes(object, false);
    } else {
      myText = "Sample";
      myIcon = PlatformIcons.DIRECTORY_CLOSED_ICON;
      myAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
    }
    Disposer.register(parent == null ? panel : parent, this);

    setOpaque(false);
    setIpad(myUI.getElementIpad(isPopupElement));

    if (!isPopupElement) {
      setMyBorder(null);
      setBorder(null);
      setPaintFocusBorder(false);
    }
    update();
  }