Example usage for javax.swing JCheckBoxMenuItem removeActionListener

List of usage examples for javax.swing JCheckBoxMenuItem removeActionListener

Introduction

In this page you can find the example usage for javax.swing JCheckBoxMenuItem removeActionListener.

Prototype

public void removeActionListener(ActionListener l) 

Source Link

Document

Removes an ActionListener from the button.

Usage

From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java

/**
 * Updates UI components when a zooming factor is selected.
 * /*from  ww w .ja v a2  s.c om*/
 * @param factor   The magnification factor.
 * @param zoomIndex The index of the selected zoomFactor.
 */
void setZoomFactor(double factor, int zoomIndex) {
    setMagnificationStatus(factor, zoomIndex);
    JCheckBoxMenuItem b;
    Enumeration e;
    Action a;
    if (zoomingGroup == null)
        return;
    for (e = zoomingGroup.getElements(); e.hasMoreElements();) {
        b = (JCheckBoxMenuItem) e.nextElement();
        a = b.getAction();
        if (a instanceof ZoomAction) {
            b.removeActionListener(a);
            b.setSelected(((ZoomAction) a).getIndex() == zoomIndex);
            b.setAction(a);
        }
    }
    controlPane.setZoomFactor(zoomIndex);
}

From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java

/** 
 * Sets the magnification for the grid view.
 * //from   www  .j  a v  a2 s.  co m
 * @param factor The value to set.
 */
void setGridMagnificationFactor(double factor) {
    if (model.getTabbedIndex() == ImViewer.GRID_INDEX)
        setMagnificationStatus(factor, ZoomAction.getIndex(factor));
    JCheckBoxMenuItem b;
    Enumeration e;
    Action a;
    int zoomIndex = ZoomGridAction.getIndex(factor);
    for (e = zoomingGridGroup.getElements(); e.hasMoreElements();) {
        b = (JCheckBoxMenuItem) e.nextElement();
        a = b.getAction();
        if (a instanceof ZoomGridAction) {
            b.removeActionListener(a);
            b.setSelected(((ZoomGridAction) a).getIndex() == zoomIndex);
            b.setAction(a);
        }
    }
    controlPane.setGridMagnificationFactor((int) (factor * 10));
}