Setting up cancel and forgot buttons and adding onClickListeners to them
559114
private void setupButtons() {
        cancelButton = (TextView) findViewById(R.id.cancelButton);
        cancelButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setResult(CANCELLED);
                finish();
            }
        });
        forgetButton = (TextView) findViewById(R.id.forgotPin);
        forgetButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onForgotPin();
                setResult(FORGOT);
                finish();
            }
        });
    }
716393
protected function addCancelButton()
    {
        $cancelUrl  = [
            $this->request->getControllerKey() => $this->request->getControllerName(),
            $this->request->getActionKey()     => $this->request->getActionName(),
            $this->resetParam                  => 1,
        ];

        $element = $this->_form->createElement('html', 'reset');
        $element->setLabel(html_entity_decode('&nbsp;'));
        $element->setValue(\Gems_Html::actionLink($cancelUrl, $this->_('Cancel login')));
        $this->_form->addElement($element);
    }
1152202
function addButtons() {

  if ( options.continue || options.follow || options.submit ) {

    var continueButton = template( defaults.buttonTemplate )
    continueButton.classList.add( 'dialog-continue' )
    if ( options.destructive ) { continueButton.classList.add( 'destructive' ) }
    continueButton.innerHTML = options.continue || 'Continue'

    dialogEl.querySelector('.dialog-actions').appendChild( continueButton )

    options.cancel = options.cancel || 'Cancel'
  }

  var cancelButton = template( defaults.buttonTemplate )

  cancelButton.classList.add( 'dialog-cancel' )
  cancelButton.innerHTML = options.cancel || ( options.continue ? 'Cancel' : 'OK' )

  dialogEl.querySelector('.dialog-actions').appendChild( cancelButton )

}
1340431
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        feedback = UserFeedback.Cancel;
        synchronized (WAITER_LOCK) {
            okButton.setEnabled(false);
            cancelButton.setEnabled(false);
            WAITER_LOCK.notifyAll();
        }
    }
116871
function offListeners(listeners, event, callback)
  {
    if (listeners && event in listeners)
    {
      var eventListeners = listeners[ event ];
      var next, node = eventListeners.next;

      while (node !== eventListeners)
      {
        next = node.next;

        if (node.callback === callback)
        {
          node.remove();
        }

        node = next;
      }
    }
  }
1334705
public final void reset() {
		unblocked = false;
		result = null;
		error = null;
		cancel = null;
		listenersInline = null;
	}
403952
function (e) {
                // call unload listeners
                // Keep a local copy of the reference to unloadListeners because it is possible that a listener calls
                // aria.utils.Event.reset (that's what AriaWindow is doing).
                var list = unloadListeners.slice();
                for (var i = 0, len = list.length; i < len; ++i) {
                    var l = list[i];
                    if (l) {
                        l[CB].call(this.getEvent(e));
                        list[i] = null;
                        l = null;
                    }
                }
                list = null;
            }
1317176
public void putAbortfunc(AbortListener listener, Object userhandle) throws LpSolveException {
		abortListener = listener;
		abortUserhandle = (listener != null) ? userhandle : null;
		addLp(this);
		registerAbortfunc();
	}
31931
function removeListeners() {
			res.removeListener('error',  removeListeners);
			res.removeListener('close',  removeListeners);
			res.removeListener('finish', onResponseFinished);
		}
467510
private void createButtons() {

        m_buttonClose.setButtonStyle(ButtonStyle.TEXT, ButtonColor.GREEN);
        m_buttonClose.setTitle(Messages.get().key(Messages.GUI_DIALOG_BUTTON_CLOSE_0));
        m_buttonClose.setText(Messages.get().key(Messages.GUI_DIALOG_BUTTON_CLOSE_0));
        m_buttonClose.setUseMinWidth(true);
        m_buttonClose.addClickHandler(new ClickHandler() {

            /**
             * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
             */
            public void onClick(ClickEvent event) {

                actionClose();
            }
        });
        m_frameDialog.addButton(m_buttonClose);

        if (m_dialogData.getResources().size() > 1) {
            m_buttonNext.setTitle(Messages.get().key(Messages.GUI_DIALOG_BUTTON_NEXT_0));
            m_buttonNext.setText(Messages.get().key(Messages.GUI_DIALOG_BUTTON_NEXT_0));
            m_buttonNext.setUseMinWidth(true);
            m_buttonNext.addClickHandler(new ClickHandler() {

                /**
                 * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
                 */
                public void onClick(ClickEvent event) {

                    actionNext();
                }
            });
            m_frameDialog.addButton(m_buttonNext);

            m_buttonBack.setTitle(Messages.get().key(Messages.GUI_DIALOG_BUTTON_BACK_0));
            m_buttonBack.setText(Messages.get().key(Messages.GUI_DIALOG_BUTTON_BACK_0));
            m_buttonBack.setUseMinWidth(true);
            m_buttonBack.addClickHandler(new ClickHandler() {

                /**
                 * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
                 */
                public void onClick(ClickEvent event) {

                    actionBack();
                }
            });
            m_frameDialog.addButton(m_buttonBack);
        }

        if (isExplorerMode() && (m_resources.size() == 1)) {
            m_buttonAdvanced.setButtonStyle(ButtonStyle.TEXT, ButtonColor.RED);
            m_buttonAdvanced.setTitle(Messages.get().key(Messages.GUI_DIALOG_BUTTON_ADVANCED_0));
            m_buttonAdvanced.setText(Messages.get().key(Messages.GUI_DIALOG_BUTTON_ADVANCED_0));
            m_buttonAdvanced.setUseMinWidth(true);
            m_buttonAdvanced.addClickHandler(new ClickHandler() {

                /**
                 * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
                 */
                public void onClick(ClickEvent event) {

                    actionAdvanced();
                }
            });
            m_frameDialog.addButton(m_buttonAdvanced);
        }
    }
113653
protected void cancel() {
        int numAnimators = mCurrentAnimators.size();
        for (int i = numAnimators - 1; i >= 0; i--) {
            Animator animator = mCurrentAnimators.get(i);
            animator.cancel();
        }
        if (mListeners != null && mListeners.size() > 0) {
            ArrayList<TransitionListener> tmpListeners =
                    (ArrayList<TransitionListener>) mListeners.clone();
            int numListeners = tmpListeners.size();
            for (int i = 0; i < numListeners; ++i) {
                tmpListeners.get(i).onTransitionCancel(this);
            }
        }
    }
1218475
private void initializeButtons() {
        setPositiveButton(android.R.string.ok, createRemovePreferenceHeaderClickListener());
        setNegativeButton(android.R.string.cancel, null);
    }
63761
void initButtons() {

        m_okButton = new Button(CmsVaadinUtils.getMessageText(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0));
        m_okButton.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {

                onClickOk();
            }
        });
        addButton(m_okButton);
        m_cancelButton = new Button(
            CmsVaadinUtils.getMessageText(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_CANCEL_0));
        m_cancelButton.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            @SuppressWarnings("synthetic-access")
            public void buttonClick(ClickEvent event) {

                m_context.finish(new ArrayList<CmsUUID>());
            }
        });

        addButton(m_cancelButton);
    }
1266775
private View.OnTouchListener createCancelOnTouchListener() {
        return new View.OnTouchListener() {

            @Override
            public boolean onTouch(final View v, final MotionEvent event) {
                if (cancelable && canceledOnTouchOutside) {
                    cancel();
                    v.performClick();
                    return true;
                }

                return false;
            }

        };
    }
60883
function clickOutside(elements, fn) {
  const self = {
    on,
    off,
    isClicked
  };

  let clickedEl;
  let handlers;

  function stop(e) {
    clickedEl = this;
    e.stopPropagation();
  }

  function pass() {
    clickedEl = undefined;
    fn();
  }

  function isClicked(el) {
    return el === clickedEl;
  }

  function on() {
    const html = document.documentElement;
    handlers = elements.map(function(el) {
      const handler = stop.bind(el);
      el.addEventListener('mousedown', handler);
      return handler;
    });
    html.addEventListener('mousedown', pass);
    return self;
  }

  function off() {
    const html = document.documentElement;
    html.removeEventListener('mousedown', pass);
    elements.forEach(function(el, i) {
      el.removeEventListener('mousedown', handlers[i]);
    });
    return self;
  }

  return self;
}
295909
private void newUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        //doClose(JOptionPane.CANCEL_OPTION);
        // Display new user dialog:
        Frame frame = ScreenUtil.getFrame(this);
        frame.remove(this);
        String strDisplay = "Create new user";
        String strUserName = userField.getText();
        NewUserDialog dialog = new NewUserDialog(frame, true, strDisplay, strUserName, this);
        if (frame != null)
            ScreenUtil.centerDialogInFrame(dialog, frame);
        dialog.setVisible(true);
        doClose(dialog.getReturnStatus());	// Pass new user dialog up
    }
765538
private OnClickListener createFinishButtonListener() {
        return new OnClickListener() {

            @Override
            public void onClick(final View v) {
                int selectedIndex = viewPager.getCurrentItem();

                if (notifyOnFinish(selectedIndex)) {
                    getDialog().dismiss();
                }
            }

        };
    }