This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
interface SpinnerModel

All Known Implementing Classes:
AbstractSpinnerModel, SpinnerDateModel, SpinnerListModel, SpinnerNumberModel

Most common way to construct:

int initValue = …;
int min = …;
int max = …;
int step = …;

SpinnerModel model = new SpinnerNumberModel(initValue, min, max, step);

Based on 37 examples


public interface SpinnerModel

A model for a potentially unbounded sequence of object values. This model is similar to ListModel however there are some important differences:

A SpinnerModel has three properties, only the first is read/write.

value
The current element of the sequence.
nextValue
The following element or null if value is the last element of the sequence.
previousValue
The preceeding element or null if value is the first element of the sequence.
When the the value property changes, ChangeListeners are notified. SpinnerModel may choose to notify the ChangeListeners under other circumstances.


Method Summary
 void

          Adds a ChangeListener to the model's listener list.
 Object

          Return the object in the sequence that comes after the object returned by getValue().
 Object

          Return the object in the sequence that comes before the object returned by getValue().
 Object

          The current element of the sequence.
 void

          Removes a ChangeListener from the model's listener list.
 void

          Changes current value of the model, typically this value is displayed by the editor part of a JSpinner.
 

Method Detail

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the model's listener list. The ChangeListeners must be notified when models value changes.

Parameters:
l - the ChangeListener to add

getNextValue

public Object getNextValue()
Return the object in the sequence that comes after the object returned by getValue(). If the end of the sequence has been reached then return null. Calling this method does not effect value.

Returns:
the next legal value or null if one doesn't exist

getPreviousValue

public Object getPreviousValue()
Return the object in the sequence that comes before the object returned by getValue(). If the end of the sequence has been reached then return null. Calling this method does not effect value.

Returns:
the previous legal value or null if one doesn't exist

getValue

public Object getValue()
The current element of the sequence. This element is usually displayed by the editor part of a JSpinner.

Returns:
the current spinner value.

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the model's listener list.

Parameters:
l - the ChangeListener to remove

setValue

public void setValue(Object value)
Changes current value of the model, typically this value is displayed by the editor part of a JSpinner. If the SpinnerModel implementation doesn't support the specified value then an IllegalArgumentException is thrown. For example a SpinnerModel for numbers might only support values that are integer multiples of ten. In that case, model.setValue(new Number(11)) would throw an exception.

Parameters:
value


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.