Search in sources :

Example 86 with ChangeListener

use of javax.swing.event.ChangeListener in project MassBank-web by MassBank.

the class DrawPane method makeZoomSpinner.

private JSpinner makeZoomSpinner(final DrawPane canvas, Action zoomIn, Action zoomOut) {
    SpinnerNumberModel snm = new SpinnerNumberModel(0.8, 0.4, 3.0, 0.1);
    final JSpinner zoomSpinner = new JSpinner(snm);
    zoomSpinner.setMaximumSize(new Dimension(60, 30));
    JSpinner.NumberEditor sne = new JSpinner.NumberEditor(zoomSpinner, "###%");
    zoomSpinner.setEditor(sne);
    zoomSpinner.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent ce) {
            canvas.zoomChangeTo((float) ((Double) (zoomSpinner.getValue())).doubleValue());
        }
    });
    zoomIn.setActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent ae) {
            Object o = zoomSpinner.getNextValue();
            if (o != null)
                zoomSpinner.setValue(o);
        }
    });
    zoomOut.setActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent ae) {
            Object o = zoomSpinner.getPreviousValue();
            if (o != null)
                zoomSpinner.setValue(o);
        }
    });
    return zoomSpinner;
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JSpinner(javax.swing.JSpinner) ChangeListener(javax.swing.event.ChangeListener) Dimension(java.awt.Dimension)

Example 87 with ChangeListener

use of javax.swing.event.ChangeListener in project knime-core by knime.

the class String2DateDialog method initializeModels.

private void initializeModels() {
    // add listener to replace column
    m_replaceModel.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            // -> set new column name model enabled = !m_replace;
            m_colNameModel.setEnabled(!m_replaceModel.getBooleanValue());
        }
    });
    addColSelectionListener(m_colSelectionModel, m_colNameModel, m_suffix);
    if (m_cancelOnFailModel != null && m_failNoModel != null) {
        // if !canFail these models are null
        m_cancelOnFailModel.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(final ChangeEvent e) {
                // if fail on cancel -> define max number of fails
                m_failNoModel.setEnabled(m_cancelOnFailModel.getBooleanValue());
            }
        });
    }
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 88 with ChangeListener

use of javax.swing.event.ChangeListener in project knime-core by knime.

the class NumericOutliersNodeDialogPane method addListeners.

/**
 * Adds listeners to the different dialog components/ model settings.
 */
private void addListeners() {
    // only enable estimation types if in-memory calculation is selected
    m_heuristicDialog.getModel().addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            toggleEstimationDialog();
        }
    });
    // only enable groups dialog if apply to groups is selected
    m_useGroupsDialog.getModel().addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            toggleGroupsDialog();
        }
    });
    m_outlierTreatmentDialog.getModel().addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            toggleReplacement();
        }
    });
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 89 with ChangeListener

use of javax.swing.event.ChangeListener in project knime-core by knime.

the class DateTimeToStringNodeModel method createSuffixModel.

/**
 * @param replaceOrAppendModel model for the replace/append button group
 * @return the string model, used in both dialog and model.
 */
public static SettingsModelString createSuffixModel(final SettingsModelString replaceOrAppendModel) {
    final SettingsModelString suffixModel = new SettingsModelString("suffix", "(String)");
    replaceOrAppendModel.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            if (replaceOrAppendModel.getStringValue().equals(OPTION_APPEND)) {
                suffixModel.setEnabled(true);
            } else {
                suffixModel.setEnabled(false);
            }
        }
    });
    suffixModel.setEnabled(false);
    return suffixModel;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 90 with ChangeListener

use of javax.swing.event.ChangeListener in project knime-core by knime.

the class TemplatesPanel method setTemplateProvider.

/**
 * Change template provider and regenerate category/template list.
 * @param provider the {@link TemplateProvider} to use
 */
public void setTemplateProvider(final TemplateProvider<T> provider) {
    m_provider = provider;
    m_provider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            updateCategories();
            updateTemplatesList(TemplateProvider.ALL_CATEGORY);
        }
    });
    updateCategories();
    updateTemplatesList(TemplateProvider.ALL_CATEGORY);
    m_templates.setSelectedIndex(-1);
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Aggregations

ChangeListener (javax.swing.event.ChangeListener)218 ChangeEvent (javax.swing.event.ChangeEvent)205 JPanel (javax.swing.JPanel)54 ActionEvent (java.awt.event.ActionEvent)47 ActionListener (java.awt.event.ActionListener)46 JLabel (javax.swing.JLabel)34 Dimension (java.awt.Dimension)29 GridBagConstraints (java.awt.GridBagConstraints)27 GridBagLayout (java.awt.GridBagLayout)24 JCheckBox (javax.swing.JCheckBox)24 Insets (java.awt.Insets)21 JSlider (javax.swing.JSlider)20 PropertyChangeListener (java.beans.PropertyChangeListener)19 JButton (javax.swing.JButton)19 BorderLayout (java.awt.BorderLayout)17 PropertyChangeEvent (java.beans.PropertyChangeEvent)17 IOException (java.io.IOException)14 BoxLayout (javax.swing.BoxLayout)14 ButtonGroup (javax.swing.ButtonGroup)14 JSpinner (javax.swing.JSpinner)13