Example usage for javax.swing.event ChangeListener stateChanged

List of usage examples for javax.swing.event ChangeListener stateChanged

Introduction

In this page you can find the example usage for javax.swing.event ChangeListener stateChanged.

Prototype

void stateChanged(ChangeEvent e);

Source Link

Document

Invoked when the target of the listener has changed its state.

Usage

From source file:fungus.UtilizationObserver.java

public static void notifyChangeListeners() {
    for (ChangeListener cl : changeListeners) {
        cl.stateChanged(new ChangeEvent(UtilizationObserver.class));
    }/*from   w w w .  j a va  2 s  . c  o  m*/
}

From source file:com.github.fritaly.dualcommander.event.ChangeEventSupport.java

public void fireEvent(ChangeEvent event) {
    Validate.notNull(event, "The given event is null");

    for (ChangeListener listener : listeners) {
        listener.stateChanged(event);
    }//from   w ww.j a  v  a  2  s  .co m
}

From source file:com.github.alexfalappa.nbspringboot.projects.initializr.InitializrProjectWizardPanel1.java

protected final void fireChangeEvent() {
    Set<ChangeListener> ls;
    synchronized (listeners) {
        ls = new HashSet<>(listeners);
    }/*from   w w w. j a v a 2  s .c  o m*/
    ChangeEvent ev = new ChangeEvent(this);
    for (ChangeListener l : ls) {
        l.stateChanged(ev);
    }
}

From source file:blue.components.lines.LinePoint.java

public void fireChangeEvent(ChangeEvent pce) {
    if (listeners != null) {
        for (Iterator iter = listeners.iterator(); iter.hasNext();) {
            ChangeListener pcl = (ChangeListener) iter.next();
            pcl.stateChanged(pce);
        }/*from   w  ww  .ja  v a2  s.c  o  m*/
    }
}

From source file:com.hp.alm.ali.idea.ui.MultiValueSelectorLabel.java

private void fireChangeEvent(Object source) {
    synchronized (listeners) {
        for (ChangeListener listener : listeners) {
            listener.stateChanged(new ChangeEvent(source));
        }/*from   ww w .j  av a2 s.  c o  m*/
    }
}

From source file:com.diversityarrays.kdxplore.vistool.AbstractVisToolPanel.java

protected void fireSelectionStateChanged() {
    for (ChangeListener l : listenerList.getListeners(ChangeListener.class)) {
        l.stateChanged(changeEvent);
    }// www  . j a  v  a  2  s .  c o  m
}

From source file:RGBAColourChooser.java

/**
 * Sets the widget's selected colour//from   w  w  w  . j ava  2s . c om
 * 
 * @param color
 *           The new colour
 */
public void setColour(Color color) {
    if (!oldValue.equals(color)) {
        // copy the values
        oldValue = color;

        redSlider.removeChangeListener(this);
        greenSlider.removeChangeListener(this);
        blueSlider.removeChangeListener(this);
        alphaSlider.removeChangeListener(this);

        redSlider.setValue(oldValue.getRed());
        greenSlider.setValue(oldValue.getGreen());
        blueSlider.setValue(oldValue.getBlue());
        alphaSlider.setValue(oldValue.getAlpha());

        redSlider.setToolTipText(String.valueOf(redSlider.getValue()));
        greenSlider.setToolTipText(String.valueOf(greenSlider.getValue()));
        blueSlider.setToolTipText(String.valueOf(blueSlider.getValue()));
        alphaSlider.setToolTipText(String.valueOf(alphaSlider.getValue()));

        redSlider.addChangeListener(this);
        greenSlider.addChangeListener(this);
        blueSlider.addChangeListener(this);
        alphaSlider.addChangeListener(this);

        previewer.repaint();

        ChangeEvent ce = new ChangeEvent(this);
        for (ChangeListener listener : listeners) {
            listener.stateChanged(ce);
        }
    }
}

From source file:net.sourceforge.processdash.ev.ui.chart.AbstractEVChart.java

protected void fireStateChanged() {
    if (changeListeners != null) {
        List<ChangeListener> listeners = new ArrayList<ChangeListener>(changeListeners);
        ChangeEvent evt = new ChangeEvent(this);
        for (ChangeListener l : listeners)
            l.stateChanged(evt);
    }/*from   w  w w  .jav  a  2  s  . c o m*/
}

From source file:edu.ku.brc.specify.ui.db.PickListTableAdapter.java

@Override
public PickListItemIFace addItem(final String title, final String value) {
    // this should never happen!
    if (pickList.getType() != PickListDBAdapterIFace.Type.TableField.value()) {
        throw new RuntimeException("This type of PickList cannot be added to");
    }/*w  w  w. j a v a 2 s. c om*/

    int sizeLimit = 50; // arbitrary size could be a pref (XXX PREF)
    Integer sizeLimitInt = pickList.getSizeLimit();
    if (sizeLimitInt != null) {
        sizeLimit = sizeLimitInt.intValue();
    }

    searchablePLI.setTitle(title);
    int index = Collections.binarySearch(items, searchablePLI);
    if (index < 0) {
        // find oldest item and remove it
        if (items.size() >= sizeLimit && sizeLimit > 0) {
            PickListItemIFace oldest = null;
            for (PickListItemIFace pli : items) {
                if (oldest == null
                        || pli.getTimestampCreated().getTime() < oldest.getTimestampCreated().getTime()) {
                    oldest = pli;
                }
            }
            items.remove(oldest);
            pickList.removeItem(oldest);
        }

        PickListItem item = new PickListItem(title, value, new Timestamp(System.currentTimeMillis()));
        items.add(item);

        if (pickList != null) {
            pickList.addItem(item);
            item.setPickList(pickList);
            pickList.reorder();
        }

        Collections.sort(items);

        super.fireContentsChanged(this, 0, items.size() - 1);

        for (ChangeListener cl : changeListeners) {
            cl.stateChanged(new ChangeEvent(this));
        }

        return item;

    }
    // else
    return items.elementAt(index);

}

From source file:FSM.java

/**
 * Fire a change event to registered listeners.
 */// w  w  w.  j av  a2  s.  co  m
protected void fireChangeEvent() {
    ChangeEvent changeEvent = new ChangeEvent(this);
    for (ChangeListener cl : changeListeners) {
        cl.stateChanged(changeEvent);
    }
}