热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

javax.swing.Action.addPropertyChangeListener()方法的使用及代码示例

本文整理了Java中javax.swing.Action.addPropertyChangeListener()方法的一些代码示例,展示了Action.ad

本文整理了Java中javax.swing.Action.addPropertyChangeListener()方法的一些代码示例,展示了Action.addPropertyChangeListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.addPropertyChangeListener()方法的具体详情如下:
包路径:javax.swing.Action
类名称:Action
方法名:addPropertyChangeListener

Action.addPropertyChangeListener介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

public ActionDelegateListener(CallbackSystemAction c, Action delegate) {
super(c);
this.delegate = new WeakReference(delegate);
delegate.addPropertyChangeListener(this);
}

代码示例来源:origin: org.netbeans.api/org-openide-util

public void attach(Action action) {
Reference d = delegate;
if ((d == null) || (d.get() == action)) {
return;
}
Action prev = d.get();
// reattaches to different action
if (prev != null) {
prev.removePropertyChangeListener(this);
}
this.delegate = new WeakReference(action);
action.addPropertyChangeListener(this);
}

代码示例来源:origin: org.netbeans.api/org-openide-util

public boolean isEnabled() {
Action a = findAction();
if (a == null) {
a = delegate;
}
// 40915 - hold last action weakly
Action last = lastRef == null ? null : lastRef.get();
if (a != last) {
if (last != null) {
last.removePropertyChangeListener(weakL);
}
lastRef = new WeakReference(a);
a.addPropertyChangeListener(weakL);
}
return a.isEnabled();
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

public ActionDelegateListener(CallbackSystemAction c, Action delegate) {
super(c);
this.delegate = new WeakReference(delegate);
delegate.addPropertyChangeListener(this);
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

/** Attaches listener to given action */
final void addNotify() {
action.addPropertyChangeListener(actionL);
updateState(null);
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

public void attach(Action action) {
Reference d = delegate;
if ((d == null) || (d.get() == action)) {
return;
}
Action prev = d.get();
// reattaches to different action
if (prev != null) {
prev.removePropertyChangeListener(this);
}
this.delegate = new WeakReference(action);
action.addPropertyChangeListener(this);
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

/** Constructs new action that is bound to given context and
* listens for changes of ActionMap in order to delegate
* to right action.
*/
protected BaseDelAction(Map map, Object key, Lookup actionContext, Action fallback, boolean surviveFocusChange, boolean async) {
this.map = map;
this.key = key;
this.fallback = fallback;
this.global = GlobalManager.findManager(actionContext, surviveFocusChange);
this.weakL = WeakListeners.propertyChange(this, fallback);
this.async = async;
if (fallback != null) {
fallback.addPropertyChangeListener(weakL);
}
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

public boolean isEnabled() {
Action a = findAction();
if (a == null) {
a = delegate;
}
// 40915 - hold last action weakly
Action last = lastRef == null ? null : lastRef.get();
if (a != last) {
if (last != null) {
last.removePropertyChangeListener(weakL);
}
lastRef = new WeakReference(a);
a.addPropertyChangeListener(weakL);
}
return a.isEnabled();
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

protected ActionListener getDelegate() {
if (delegate == null) {
ActionListener al;
if (parent == null) {
Object listener = map.get("delegate"); // NOI18N
if (!(listener instanceof ActionListener)) {
throw new NullPointerException("No 'delegate' in " + map);
}
al = (ActionListener) listener;
} else {
al = parent.getDelegate();
}
delegate = bindToContext(al, context);
if (delegate instanceof Action) {
Action actiOnDelegate= (Action) delegate;
if (weakL == null) {
weakL = WeakListeners.propertyChange(this, actionDelegate);
}
actionDelegate.addPropertyChangeListener(weakL);
// Ensure display names and other properties are in sync or propagate them
syncActionDelegateProperty(Action.NAME, actionDelegate);
}
}
return delegate;
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

void updateState(ActionMap prev, ActionMap now, boolean fire) {
if (key == null) {
return;
}
boolean prevEnabled = false;
if (prev != null) {
Action prevAction = prev.get(key);
if (prevAction != null) {
prevEnabled = fire && prevAction.isEnabled();
prevAction.removePropertyChangeListener(weakL);
}
}
if (now != null) {
Action nowAction = now.get(key);
boolean nowEnabled;
if (nowAction != null) {
nowAction.addPropertyChangeListener(weakL);
nowEnabled = nowAction.isEnabled();
} else {
nowEnabled = fallback != null && fallback.isEnabled();
}
PropertyChangeSupport sup = fire ? support : null;
if (sup != null && nowEnabled != prevEnabled) {
sup.firePropertyChange("enabled", prevEnabled, !prevEnabled); // NOI18N
}
}
}

代码示例来源:origin: org.jspresso.framework/jspresso-swing-components

/**
* {@inheritDoc}
*/
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
delegate.addPropertyChangeListener(listener);
}

代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-actions

@Override
public void addPropertyChangeListener (final @Nonnull PropertyChangeListener listener)
{
delegate.addPropertyChangeListener(listener);
}

代码示例来源:origin: in.jlibs/org-openide-util

public ActionDelegateListener(CallbackSystemAction c, Action delegate) {
super(c);
this.delegate = new WeakReference(delegate);
delegate.addPropertyChangeListener(this);
}

代码示例来源:origin: org.orbisgis/orbisgis-view

private void setAction(Action newAction) {
if(action!=null) {
action.removePropertyChangeListener(visibleListener);
}
if(newAction!=null) {
newAction.addPropertyChangeListener(visibleListener);
}
action = newAction;
}
@Override

代码示例来源:origin: sarahtattersall/PIPE

/**
* Constructor
*
* @param a toggle action to perform when the button is pressed
*/
public ToggleButton(Action a) {
super(a);
if (a.getValue(Action.SMALL_ICON) != null) {
setText(null);
}
a.addPropertyChangeListener(this);
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

public ToggleActionPropertyChangeListener(Action action, AbstractButton button) {
if (shouldAddListener(action, button)) {
this.buttOnRef= new WeakReference(button);
action.addPropertyChangeListener(this);
}
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public void attach (javax.swing.Action action) {
if (delegate == action) {
return;
}

// reattaches to different action
if (this.delegate != null) {
this.delegate.removePropertyChangeListener(this);
}

this.delegate = action;
action.addPropertyChangeListener(this);
}

代码示例来源:origin: org.orbisgis/orbisgis-view

public CButtonExt(Action action) {
this.action = action;
// Read properties from the action
onActionPropertyChange(new PropertyChangeEvent(action,null,null,null));
// Listen to action property changes
action.addPropertyChangeListener(
EventHandler.create(PropertyChangeListener.class, this, "onActionPropertyChange", ""));
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
* Installs listeners on the view object.
*/
@Override
protected void installViewListeners(View p) {
super.installViewListeners(p);
Action undoActiOnInView= p.getActionMap().get(ID);
if (undoActionInView != null && undoActionInView != this) {
undoActionInView.addPropertyChangeListener(redoActionPropertyListener);
}
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
* Description of the Method
*
* @param b Description of Parameter
* @param a Description of Parameter
*/
private void registerButtonForAction(AbstractButton b, Action a) {
PropertyChangeListener actiOnPropertyChangeListener=
createActionChangeListener(b);
a.addPropertyChangeListener(actionPropertyChangeListener);
b.setEnabled(a.isEnabled());
}

推荐阅读
author-avatar
手机用户2502925683
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有