public class SpinnerIsAdjustingUI
extends javax.swing.plaf.basic.BasicSpinnerUI
JSpinner
in order to check before a ChangeListener
to check
if the spinner is being changed or the value is final (similar as the JSlider
).
Use as (e.g.):
JSpinner spinnerMax = new JSpinner(new SpinnerNumberModel(50, -0, 100, 10));
SpinnerIsAdjustingUI spinnerMaxUIIsAdjustingUI = new SpinnerIsAdjustingUI();
spinnerMax.setUI(spinnerMaxUIIsAdjustingUI);
spinnerMax.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
double val = (double) spinnerMax.getValue();
if (!spinnerMaxUIIsAdjustingUI.getValueIsAdjusting()) {
...
Constructor and Description |
---|
SpinnerIsAdjustingUI() |
Modifier and Type | Method and Description |
---|---|
protected java.awt.Component |
createNextButton() |
protected java.awt.Component |
createPreviousButton() |
boolean |
getValueIsAdjusting() |
createEditor, createLayout, createPropertyChangeListener, createUI, getBaseline, getBaselineResizeBehavior, installDefaults, installKeyboardActions, installListeners, installNextButtonListeners, installPreviousButtonListeners, installUI, replaceEditor, uninstallDefaults, uninstallListeners, uninstallUI
public boolean getValueIsAdjusting()
protected java.awt.Component createNextButton()
createNextButton
in class javax.swing.plaf.basic.BasicSpinnerUI
protected java.awt.Component createPreviousButton()
createPreviousButton
in class javax.swing.plaf.basic.BasicSpinnerUI
Copyright © 2004-2020 FEUP-LSTS and Neptus developers. All Rights Reserved.