001package icy.gui.component;
002
003import icy.gui.component.editor.SpecialValueSpinnerEditor;
004import icy.gui.component.model.SpecialValueSpinnerModel;
005
006import javax.swing.JComponent;
007import javax.swing.JSpinner;
008import javax.swing.SpinnerModel;
009
010/**
011 * JSpinner component using a special value for a specific state.
012 * 
013 * @author Stephane
014 */
015public class SpecialValueSpinner extends JSpinner
016{
017    /**
018     * 
019     */
020    private static final long serialVersionUID = 1858500300780069742L;
021
022    /**
023     * Create a new IcySpinner
024     */
025    public SpecialValueSpinner()
026    {
027        this(new SpecialValueSpinnerModel());
028    }
029
030    /**
031     * @param model
032     */
033    public SpecialValueSpinner(SpecialValueSpinnerModel model)
034    {
035        super(model);
036    }
037
038    @Override
039    protected JComponent createEditor(SpinnerModel model)
040    {
041        if (model instanceof SpecialValueSpinnerModel)
042            return new SpecialValueSpinnerEditor(this);
043
044        return super.createEditor(model);
045    }
046
047}