private void showPopupMenu() {
   try {
     int y = (int) displayButton.getLocation().getY() + displayButton.getHeight();
     popupMenu.show(displayButton, 0, y);
   } catch (Exception ex) {
     Application.getActiveApplication().getOutput().output(ex);
   }
 }
  public SmButtonDropdown(IForm formClass, XMLCommand xmlCommand, JComponent parent) {
    super.setToolTipText(xmlCommand.getTooltip());

    displayButton = new ControlButton(this);
    displayButton.setPreferredSize(new Dimension(32, 24));
    String[] pathPrams = new String[] {PathUtilties.getRootPathName(), xmlCommand.getImageFile()};
    String path = PathUtilties.combinePath(pathPrams, false);
    File file = new File(path);
    if (file.exists() && file.isFile()) {
      displayButton.setIcon(new ImageIcon(path));
    } else {
      displayButton.setText(xmlCommand.getLabel());
    }
    displayButton.setToolTipText(xmlCommand.getLabel());

    arrowButton = new ControlButton(this);
    arrowButton.setIcon(new MetalComboBoxIcon());
    arrowButton.setPreferredSize(new Dimension(16, displayButton.getPreferredSize().height));
    Insets insets = arrowButton.getMargin();
    arrowButton.setMargin(new Insets(insets.top, 1, insets.bottom, 1));

    XMLButtonDropdown xmlButtonDropdown = (XMLButtonDropdown) xmlCommand;
    popupMenu = new SmPopupMenu(xmlButtonDropdown.getDropdownMenu());

    arrowButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            showPopupMenu();
          }
        });
    setupLayout();

    this.formClass = formClass;
    this.xmlCommand = xmlCommand;

    try {
      ICtrlAction ctrlAction =
          Application.getActiveApplication()
              .getCtrlAction(
                  xmlCommand.getPluginInfo().getBundleName(), xmlCommand.getCtrlActionClass());
      if (ctrlAction == null) {
        ctrlAction = CtrlActionUtilties.getCtrlAction(xmlCommand, this, this.formClass);
      }

      if (ctrlAction != null) {
        ctrlAction.setFormClass(this.formClass);
        setCtrlAction(ctrlAction);
        Application.getActiveApplication()
            .setCtrlAction(
                xmlCommand.getPluginInfo().getBundleName(),
                xmlCommand.getCtrlActionClass(),
                ctrlAction);
      } else {
        this.setToolTipText(this.getToolTipText() + CommonProperties.getString("String_UnDo"));
      }

      displayButton.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              item_ActionPerformed();
            }
          });

    } catch (Exception ex) {
      Application.getActiveApplication().getOutput().output(ex);
    }
  }