javax.swing.event.ChangeListener类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(202)

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

ChangeListener介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

/** Informs every listeners that system-wide configuration changed. */
public static void fireConfigurationChanged() {
  final ChangeEvent event = new ChangeEvent(GeoTools.class);
  final Object[] listeners = LISTENERS.getListenerList();
  for (int i = 0; i < listeners.length; i += 2) {
    if (listeners[i] == ChangeListener.class) {
      ((ChangeListener) listeners[i + 1]).stateChanged(event);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

protected final void fireChangeEvent() {
  Iterator<ChangeListener> it;
  synchronized (listeners) {
    it = new HashSet<>(listeners).iterator();
  }
  ChangeEvent ev = new ChangeEvent(this);
  while (it.hasNext()) {
    it.next().stateChanged(ev);
  }
}

代码示例来源:origin: dcaoyuan/nbscala

protected final void fireChangeEvent() {
 Set<ChangeListener> ls;
 synchronized (listeners) {
  ls = new HashSet<ChangeListener>(listeners);
 }
 ChangeEvent ev = new ChangeEvent(this);
 for (ChangeListener l : ls) {
  l.stateChanged(ev);
 }
}

代码示例来源:origin: nodebox/nodebox

protected void fireStateChanged() {
  if (changeEvent == null) {
    changeEvent = new ChangeEvent(this);
  }
  for (EventListener l : listenerList.getListeners(ChangeListener.class)) {
    ((ChangeListener) l).stateChanged(changeEvent);
  }
}

代码示例来源:origin: freeplane/freeplane

public void fireStateChanged() {
  final ChangeListener[] currentChangeListeners = changeListeners.toArray(new ChangeListener[changeListeners.size()]);
  for (ChangeListener l : currentChangeListeners) {
    if (changeEvent == null) {
      changeEvent = new ChangeEvent(this);
    }
    l.stateChanged(changeEvent);
  }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * notfies all listener of the change
 */
public void notifyListener() {
 Iterator<ChangeListener> iter;
 iter = m_ChangeListeners.iterator();
 while (iter.hasNext()) {
  iter.next().stateChanged(new ChangeEvent(this));
 }
}

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

/** Fires notification about reordering to all
* registered listeners.
*
* @param che change event to fire off
*/
protected void fireChangeEvent(ChangeEvent che) {
  if (listeners == null) {
    return;
  }
  HashSet cloned;
  // clone listener list
  synchronized (this) {
    cloned = (HashSet) listeners.clone();
  }
  // fire on cloned list to prevent from modifications when firing
  for (Iterator iter = cloned.iterator(); iter.hasNext();) {
    ((ChangeListener) iter.next()).stateChanged(che);
  }
}

代码示例来源:origin: libgdx/libgdx

public void setValue (float value) {
  this.value = (int)(Math.max(min, Math.min(max, value)) / stepSize) * stepSize;
  repaint();
  if (listener != null) listener.stateChanged(new ChangeEvent(this));
}

代码示例来源:origin: com.googlecode.blaisemath/blaise-math

/** Notify interested listeners of an (unspecified) change in the plottable. */
public synchronized void fireStateChanged() {
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length - 2; i >= 0; i -= 2)
    if (listeners[i] == ChangeListener.class) {
      if (changeEvent == null)
        return;
      ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent);
    }
}

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

/**
 * Fires the specified <code>ChangeEvent</code> to all registered
 * listeners. If <code>event</code> is null, no exception is thrown
 * and no action is taken.
 *
 * @param  event the <code>ChangeEvent</code> to be fired.
 */
private void fireChange(ChangeEvent event) {
  assert event != null;
  for (ChangeListener listener : listeners) {
    try {
      listener.stateChanged(event);
    } catch (RuntimeException x) {
      Exceptions.printStackTrace(x);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

protected final void fireChangeEvent() {
  Iterator<ChangeListener> it;
  synchronized (listeners) {
    it = new HashSet<>(listeners).iterator();
  }
  ChangeEvent ev = new ChangeEvent(this);
  while (it.hasNext()) {
    it.next().stateChanged(ev);
  }
}

代码示例来源:origin: eu.agrosense.client/io-shape

protected final void fireChangeEvent() {
  Set<ChangeListener> ls;
  synchronized (listeners) {
    ls = new HashSet<>(listeners);
  }
  ChangeEvent ev = new ChangeEvent(this);
  for (ChangeListener l : ls) {
    l.stateChanged(ev);
  }
}

代码示例来源:origin: nodebox/nodebox

protected void fireStateChanged() {
  if (changeEvent == null) {
    changeEvent = new ChangeEvent(this);
  }
  for (EventListener l : listenerList.getListeners(ChangeListener.class)) {
    ((ChangeListener) l).stateChanged(changeEvent);
  }
}

代码示例来源:origin: net.sf.meka/meka

/**
 * notfies all listener of the change
 */
public void notifyListener() {
  Iterator<ChangeListener> iter;
  iter = m_ChangeListeners.iterator();
  while (iter.hasNext()) {
    iter.next().stateChanged(new ChangeEvent(this));
  }
}

代码示例来源:origin: libgdx/libgdx

public void setValue (float value) {
  this.value = (int)(Math.max(min, Math.min(max, value)) / stepSize) * stepSize;
  repaint();
  if (listener != null) listener.stateChanged(new ChangeEvent(this));
}

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

/** Called when new file system is added to the pool.
* @param ev event describing the action
*/
@Override public void stateChanged(final ChangeEvent ev) {
  ChangeListener l = (ChangeListener) super.get(ev);
  if (l != null) {
    l.stateChanged(ev);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

protected final void fireChangeEvent() {
  Iterator<ChangeListener> it;
  synchronized (listeners) {
    it = new HashSet<>(listeners).iterator();
  }
  ChangeEvent ev = new ChangeEvent(this);
  while (it.hasNext()) {
    it.next().stateChanged(ev);
  }
}

代码示例来源:origin: nl.cloudfarming.client/fleet-implement

protected final void fireChangeEvent() {
  Set<ChangeListener> ls;
  synchronized (listeners) {
    ls = new HashSet<>(listeners);
  }
  ChangeEvent ev = new ChangeEvent(this);
  for (ChangeListener l : ls) {
    l.stateChanged(ev);
  }
}

代码示例来源:origin: nodebox/nodebox

/**
 * Send a ChangeEvent, whose source is this Slider, to
 * each listener.  This method method is called each time
 * a ChangeEvent is received from the model.
 *
 * @see #addChangeListener
 * @see javax.swing.event.EventListenerList
 */
protected void fireStateChanged() {
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length - 2; i >= 0; i -= 2) {
    if (listeners[i] == ChangeListener.class) {
      if (changeEvent == null) {
        changeEvent = new ChangeEvent(this);
      }
      ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent);
    }
  }
}

代码示例来源:origin: elki-project/elki

/**
 * Notify listeners of a changed value.
 */
protected void fireValueChanged() {
 // FIXME: compare with previous value?
 ChangeEvent evt = new ChangeEvent(this);
 for(ChangeListener listener : listenerList.getListeners(ChangeListener.class)) {
  listener.stateChanged(evt);
 }
}

相关文章