當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractButton.addActionListener方法代碼示例

本文整理匯總了Java中javax.swing.AbstractButton.addActionListener方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractButton.addActionListener方法的具體用法?Java AbstractButton.addActionListener怎麽用?Java AbstractButton.addActionListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.AbstractButton的用法示例。


在下文中一共展示了AbstractButton.addActionListener方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeButtonPanel

import javax.swing.AbstractButton; //導入方法依賴的package包/類
protected JPanel makeButtonPanel(AbstractButton... buttons) {
	JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, GAP, GAP));
	for (final AbstractButton button : buttons) {
		if (button != null) {
			buttonPanel.add(button);
			button.addActionListener(new ActionListener() {

				@Override
				public void actionPerformed(ActionEvent e) {
					ActionStatisticsCollector.getInstance().log(ActionStatisticsCollector.TYPE_DIALOG, key,
							button.getActionCommand());
				}
			});
		}
	}
	return buttonPanel;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:18,代碼來源:ButtonDialog.java

示例2: initActionListener

import javax.swing.AbstractButton; //導入方法依賴的package包/類
private void initActionListener(Component[] cps) {
    for (Component cp : cps) {
        if (cp instanceof AbstractButton) {
            AbstractButton ccp = (AbstractButton) cp;
            ccp.addActionListener(this);
        }
    }
}
 
開發者ID:ajtdnyy,項目名稱:ScreenCut,代碼行數:9,代碼來源:ScreenCut.java

示例3: initialize

import javax.swing.AbstractButton; //導入方法依賴的package包/類
/**
 * Initializes a specified presenter.
 *
 * @param  presenter  presenter to initialize
 */
private void initialize(AbstractButton presenter, boolean useIcons) {

    if (useIcons) {
        // set the presenter's icon:
        Image icon = ImageUtilities.loadImage(
                "org/netbeans/modules/url/urlObject.png");              //NOI18N
        try {
            FileObject file = dataObject.getPrimaryFile();
            icon = FileUIUtils.getImageDecorator(file.getFileSystem()).
                    annotateIcon(icon,
                        BeanInfo.ICON_COLOR_16x16,
                        dataObject.files());
        } catch (FileStateInvalidException fsie) {
            // OK, so we use the default icon
        }
        presenter.setIcon(new ImageIcon(icon));
    }

    /* set the presenter's text and ensure it is maintained up-to-date: */
    NameChangeListener listener = new NameChangeListener(presenter);
    presenter.addPropertyChangeListener(
            WeakListeners.propertyChange(listener, dataObject));
    updateName(presenter);
    /*
     * The above code works with the assumption that it is called
     * from the AWT event dispatching thread (it manipulates
     * the presenter's display name). The same applies to
     * NameChangeListener's method propertyChange(...).
     *
     * At least, both mentioned parts of code should be called from
     * the same thread since method updateText(...) is not thread-safe.
     */

    presenter.addActionListener(this);
    HelpCtx.setHelpIDString(presenter,
                            dataObject.getHelpCtx().getHelpID());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:43,代碼來源:URLPresenter.java

示例4: subscribeActual

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super ActionEvent> observer) {
    AbstractButton w = widget;

    ActionEventConsumer aec = new ActionEventConsumer(observer, w);
    observer.onSubscribe(aec);

    w.addActionListener(aec);
    if (aec.get() == null) {
        w.removeActionListener(aec);
    }
}
 
開發者ID:akarnokd,項目名稱:RxJava2Swing,代碼行數:13,代碼來源:ActionEventObservable.java

示例5: attachButton

import javax.swing.AbstractButton; //導入方法依賴的package包/類
/** Attaches given button to this recognizer, it means starts listening
 * on its various mouse and action events
 */
public void attachButton (AbstractButton button) {
    button.addActionListener(this);
    button.addMouseListener(this);
    button.addMouseMotionListener(this);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:SlideGestureRecognizer.java

示例6: getToolbarPresenter

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
public Component getToolbarPresenter() {
    final AbstractButton suspendIOButton = new JToggleButton();
    Actions.connect(suspendIOButton, this);
    updateButton(suspendIOButton);
    final class Controller implements Runnable, ActionListener {
        private RequestProcessor.Task updateTask;
        
        Controller() {
            updateTask = RP.create(this);
            scheduleUpdate(0);
        }
        
        @Override
        public void run() {
            if (!EventQueue.isDispatchThread()) {
                EventQueue.invokeLater(this);
                return;
            }
            if (!suspendIOButton.isShowing()) {
                return;
            }
            updateButton(suspendIOButton);
            scheduleUpdate(0);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            updateButton(suspendIOButton);
            run();
            scheduleUpdate(100);
        }

        private void scheduleUpdate(int time) {
            if (time == 0) {
                time = 1500;
            }
            updateTask.schedule(time);
        }
    }
    Controller c = new Controller();
    suspendIOButton.addActionListener(c);
    
    return suspendIOButton;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:46,代碼來源:PauseAction.java

示例7: ButtonBridge

import javax.swing.AbstractButton; //導入方法依賴的package包/類
public ButtonBridge(AbstractButton button, Action action) {
    super(button, action);
    button.addActionListener(action);
    this.button = button;
    button.addActionListener(this);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:Actions.java


注:本文中的javax.swing.AbstractButton.addActionListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。