本文整理匯總了Java中javax.swing.AbstractButton.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractButton.setEnabled方法的具體用法?Java AbstractButton.setEnabled怎麽用?Java AbstractButton.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.AbstractButton
的用法示例。
在下文中一共展示了AbstractButton.setEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureToolbarButton
import javax.swing.AbstractButton; //導入方法依賴的package包/類
private void configureToolbarButton (AbstractButton item, String containerCtx, String action, ActionProvider provider, Map ctx) {
item.setFocusable(false);
item.setName(action);
item.putClientProperty (KEY_ACTION, action);
item.setToolTipText(
provider.getDisplayName(action, containerCtx));
// item.setToolTipText(provider.getDescription(action, containerCtx));
int state = ctx == null ? ActionProvider.STATE_VISIBLE :
provider.getState (action, containerCtx, ctx);
boolean enabled = (state & ActionProvider.STATE_ENABLED) != 0;
item.setEnabled(enabled);
boolean visible = (state & ActionProvider.STATE_VISIBLE) != 0;
item.setVisible (visible);
boolean toggled = (state & ActionProvider.STATE_SELECTED) != 0;
item.setSelected(toggled);
// item.setMnemonic(provider.getMnemonic(action, containerCtx));
// item.setDisplayedMnemonicIndex(provider.getMnemonicIndex(action, containerCtx));
item.setIcon(provider.getIcon(action, containerCtx, BeanInfo.ICON_COLOR_16x16));
}
示例2: setChoicesEnabled
import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
protected void setChoicesEnabled(boolean enabled)
{
for( AbstractButton button : choices.keySet() )
{
button.setEnabled(enabled);
}
}
示例3: 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
}
示例4: removeViewer
import javax.swing.AbstractButton; //導入方法依賴的package包/類
public void removeViewer(AEViewer v) {
if (getViewers().remove(v) == false) {
log.warning("JAERViewer.removeViewer(): " + v + " is not in viewers list");
} else {
syncEnableButtons.remove(v.getSyncEnabledCheckBoxMenuItem());
}
boolean en = true; //viewers.size()>1? true:false;
for (AbstractButton bb : syncEnableButtons) {
bb.setEnabled(en);
}
}
示例5: disableButtons
import javax.swing.AbstractButton; //導入方法依賴的package包/類
protected void disableButtons() {
for(AbstractButton b: buttons)
{
b.setEnabled(false);
b.setSelected(false);
}
}