Example usage for javax.swing JSlider getName

List of usage examples for javax.swing JSlider getName

Introduction

In this page you can find the example usage for javax.swing JSlider getName.

Prototype

public String getName() 

Source Link

Document

Gets the name of the component.

Usage

From source file:AtomPanel.java

/** Listen to the slider. */
public void stateChanged(ChangeEvent e) {
    JSlider source = (JSlider) e.getSource();
    if ("faRate".equals(source.getName())) {
        if (!source.getValueIsAdjusting()) {
            double L = (double) source.getValue();
            falseAlarmRate = 0.001 * L; // L is 1-10, map it to 0.001-0.01
        }/*w w  w . ja va  2s  . c  o  m*/
    } else if ("wdSz".equals(source.getName())) { //"window size"
        if (!source.getValueIsAdjusting()) {
            double L = (double) source.getValue();
            wdSz = 20 * (int) (L); // L is 1-10, map it to 40-400
        }
    } else if ("delta".equals(source.getName())) { //"delta"
        if (!source.getValueIsAdjusting()) {
            double L = (double) source.getValue();
            percent = 0.02 * (L - 1); // L is 1-10, map it to 0-0.2
        }
    } else if ("devbnd".equals(source.getName())) { //"deviation bound"
        if (!source.getValueIsAdjusting()) {
            double L = (double) source.getValue();
            devBnd = 0.001 * (L - 1) / 9; // L is 1-10, map it to 0-0.01
        }
    }
}