set button based on Action
436100
def action a
      text a.name
      mnemonic a.mnemonic unless a.mnemonic.nil?
      command { a.call }
    end
456200
def on_select(self, item, action):
        

        if not isinstance(item, int):
            item = self.items.index(item)

        self._on_select[item] = action
435982
public void configureButton(AbstractButton button) {
        Assert.notNull(button);
        button.setText(this.text);
        button.setMnemonic(getMnemonic());
        button.setDisplayedMnemonicIndex(getMnemonicIndex());
    }
985585
def toggle(self, event):
        """"""

        if self.state < len(self.bitmap_list) - 1:
            self.state += 1
        else:
            self.state = 0

        self.SetBitmapLabel(self.bitmap_list[self.state])

        try:
            event.Skip()
        except AttributeError:
            pass

        """For compatibility with toggle buttons"""
        setattr(self, "GetToolState", lambda x: self.state)
441131
def OnButtonCell(self, event):
        """"""

        # The button text
        text = event.text

        with undo.group(_("Button")):
            self.grid.actions.set_attr("button_cell", text)

        self.grid.ForceRefresh()

        self.grid.update_attribute_toolbar()

        event.Skip()
1318316
public function setAction($action) {
        $this->setVariable(self::ACTION, $this->assembleAssignmentString(self::DATA_HREF, $action));
        $this->setEventType(self::CLICK_EVENT);
        $this->addClass(self::AJAX_ELEMENT_CLASS);
        if(!$this->getId()) {
            $this->setId("button_".floor(rand(0, 1000)));
        }
    }
1218032
function() {
            var options = this.getSelected();

            // First update the displayed button text.
            $('button', this.$container).html(this.options.buttonText(options, this.$select));

            // Now update the title attribute of the button.
            $('button', this.$container).attr('title', this.options.buttonTitle(options, this.$select));

        }
239275
def setWebView( self, webView ):
        
        if ( self._webView ):
            self._webView.removeAction(self._findAction)
        
        self._webView = webView
        if ( webView ):
            webView.addAction(self._findAction)
125793
def set_bind(self):
        
        self.bind('<Button-1>', lambda e: self.add(0.1))
        self.bind('<Button-3>', lambda e: self.sub(0.1))
        self.bind('<Up>', lambda e: self.add(0.1))
        self.bind('<Down>', lambda e: self.sub(0.1))
        self.bind('<Shift-Up>', lambda e: self.add(1))
        self.bind('<Shift-Down>', lambda e: self.sub(1))
        self.bind('<Control-Up>', lambda e: self.add(10))
        self.bind('<Control-Down>', lambda e: self.sub(10))
        self.bind('<Double-Button-1>', self._dadd)
        self.bind('<Double-Button-3>', self._dsub)
        self.bind('<Shift-Button-1>', lambda e: self.add(1))
        self.bind('<Shift-Button-3>', lambda e: self.sub(1))
        self.bind('<Control-Button-1>', lambda e: self.add(10))
        self.bind('<Control-Button-3>', lambda e: self.sub(10))
        self.bind('<Enter>', self._enter)
1067445
public function setActionCustom(
        string $url = null,
        string $label = '',
        string $class = 'btn btn-primary btn-outline-primary btn-sm flat',
        string $icon = 'fa fa-paw'
    ): ButtonInterface {
        if (!$url) {
            $url = '#';
        }
        $this->setAction(self::TYPE_ACTION_CUSTOM)
            ->setUrl($url)
            ->setLabel($label)
            ->setClass($class)
            ->setIcon($icon);

        return $this;
    }
1076081
def _on_action_toggle(self):
        """"""
        block = FoldScope.find_parent_scope(self.editor.textCursor().block())
        self.toggle_fold_trigger(block)
462746
def on_state(self, *args):
        """"""
        # This really ought to be done with the selection behavior
        if self.state == 'down':
            self.rulesview.rule = self.rule
            for button in self.ruleslist.children[0].children:
                if button != self:
                    button.state = 'normal'
1236399
protected void onChange()
	{
		enabled = false;
		if (getDocument().getLength() > 0)
		{
			enabled = true;
		}
		buttonModel.setEnabled(enabled);
	}
741907
function(_event){
                if (_event.button === 0) {
                    _v._$addEvent(this,'mousemove',_onMouseMove);
                    setTimeout(_dispatchIfChanged.bind(null, this), 0);
                }
            }
644277
def apply_clicked(self, button):
        
        if isinstance(self.model.state, LibraryState):
            return

        self.set_script_text(self.view.get_text())
969868
public void actionPerformed(ActionEvent e) {
		JButton button = (JButton) e.getSource();
		String buttonText = button.getText();
		int day = new Integer(buttonText).intValue();
		setDay(day);
	}
450524
def setButton(self, which, button):
        
        try:
            self._buttons[which].deleteLater()
        except KeyError:
            pass

        button.setParent(self)
        self._buttons[which] = button