@Override
      public Dimension getPreferredSize() {
        Dimension size = super.getPreferredSize();
        if (myGearLabel.getIcon() == null && (myCloseButton == null || !myCloseButton.isVisible())) {
          size.width = 0;
        }
        return size;
      }
@Override
      public Dimension getPreferredSize()