本文整理汇总了Java中javax.swing.JButton.setSelected方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setSelected方法的具体用法?Java JButton.setSelected怎么用?Java JButton.setSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setSelected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PresenterUpdater
import javax.swing.JButton; //导入方法依赖的package包/类
private PresenterUpdater(int type, Action action) {
if (action == null) {
throw new IllegalArgumentException("action must not be null"); // NOI18N
}
this.type = type;
this.actionName = (String) action.getValue(Action.NAME);
this.action = action;
if (type == TOOLBAR) {
presenter = new JButton();
useActionSelectedProperty = false;
} else { // MENU or POPUP
useActionSelectedProperty = (action.getValue(AbstractEditorAction.PREFERENCES_KEY_KEY) != null);
if (useActionSelectedProperty) {
presenter = new LazyJCheckBoxMenuItem();
presenter.setSelected(isActionSelected());
} else {
presenter = new LazyJMenuItem();
}
}
action.addPropertyChangeListener(WeakListeners.propertyChange(this, action));
if (type == MENU) {
listenedContextActions = new WeakSet<Action>();
EditorRegistryWatcher.get().registerPresenterUpdater(this); // Includes notification of active component
} else {
listenedContextActions = null;
}
presenter.addActionListener(this);
updatePresenter(null); // Not active yet => mark updates pending
}
示例2: erzeugeAusleiheButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Erzeugt den Ausleih-Button für das Menü
*/
private void erzeugeAusleiheButton()
{
_ausleiheButton = new JButton();
initialisiereMenuButton(_ausleiheButton, AUSLEIHE);
_ausleiheButton.setSelected(true);
}