当前位置: 首页>>代码示例>>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;未经允许,请勿转载。