本文整理匯總了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);
}