本文整理汇总了Java中javax.swing.AbstractButton.setAction方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractButton.setAction方法的具体用法?Java AbstractButton.setAction怎么用?Java AbstractButton.setAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.AbstractButton
的用法示例。
在下文中一共展示了AbstractButton.setAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildMenus
import javax.swing.AbstractButton; //导入方法依赖的package包/类
void buildMenus(AEViewer v) {
// log.info("building AEViewer sync menus");
JMenu m = v.getFileMenu();
ToggleLoggingAction action = new ToggleLoggingAction(v);
v.getLoggingButton().setAction(action);
v.getLoggingMenuItem().setAction(action);
// adds to each AEViewers syncenabled check box menu item the toggleSyncEnabledAction
AbstractButton b = v.getSyncEnabledCheckBoxMenuItem();
b.setAction(getToggleSyncEnabledAction());
syncEnableButtons.add(b); // we need this stupid list because java 1.5 doesn't have Action property to support togglebuttons selected state (1.6 adds it)
b.setSelected(isSyncEnabled());
AbstractButton bbb = v.getPlayerControls().getSyncPlaybackCheckBox(); // TODO dependency, depends on existing player control panel
syncEnableButtons.add(bbb);
bbb.setSelected(isSyncEnabled());
bbb.setAction(getToggleSyncEnabledAction());
boolean en = true; //viewers.size()>1? true:false;
for (AbstractButton bb : syncEnableButtons) {
bb.setEnabled(en);
}
syncPlayer.getSupport().addPropertyChangeListener(v.getPlayerControls()); // TODO not very clean way of adding property change support....
// if(en==false) syncEnableButtons.get(0).setSelected(false); // disable sync if there is only one viewer
}
示例2: createAbstractButton
import javax.swing.AbstractButton; //导入方法依赖的package包/类
private static AbstractButton createAbstractButton(AbstractButton button, Action action) {
button.setAction(action);
mnemonicAndToolTip(button, (String) action.getValue(Action.SHORT_DESCRIPTION));
return button;
}