-
- All Known Implementing Classes:
- AbstractSpinnerModel, SpinnerDateModel, SpinnerListModel, SpinnerNumberModel
public interface SpinnerModel
A model for a potentially unbounded sequence of object values. This model is similar toListModel
however there are some important differences:- The number of sequence elements isn't neccessarily bounded.
- The model doesn't support indexed random access to sequence elements. Only three sequence values are accessible at a time: current, next and previous.
- The current sequence element, can be set.
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.
value
property changes,ChangeListeners
are notified.SpinnerModel
may choose to notify theChangeListeners
under other circumstances.- Since:
- 1.4
- See Also:
JSpinner
,AbstractSpinnerModel
,SpinnerListModel
,SpinnerNumberModel
,SpinnerDateModel
-
-
Method Summary
Methods Modifier and Type Method and Description void
addChangeListener(ChangeListener l)
Adds aChangeListener
to the model's listener list.Object
getNextValue()
Return the object in the sequence that comes after the object returned bygetValue()
.Object
getPreviousValue()
Return the object in the sequence that comes before the object returned bygetValue()
.Object
getValue()
The current element of the sequence.void
removeChangeListener(ChangeListener l)
Removes aChangeListener
from the model's listener list.void
setValue(Object value)
Changes current value of the model, typically this value is displayed by theeditor
part of aJSpinner
.
-
-
-
Method Detail
-
getValue
Object getValue()
The current element of the sequence. This element is usually displayed by theeditor
part of aJSpinner
.- Returns:
- the current spinner value.
- See Also:
setValue(java.lang.Object)
-
setValue
void setValue(Object value)
Changes current value of the model, typically this value is displayed by theeditor
part of aJSpinner
. If theSpinnerModel
implementation doesn't support the specified value then anIllegalArgumentException
is thrown. For example aSpinnerModel
for numbers might only support values that are integer multiples of ten. In that case,model.setValue(new Number(11))
would throw an exception.- Throws:
IllegalArgumentException
- ifvalue
isn't allowed- See Also:
getValue()
-
getNextValue
Object getNextValue()
Return the object in the sequence that comes after the object returned bygetValue()
. If the end of the sequence has been reached then return null. Calling this method does not effectvalue
.- Returns:
- the next legal value or null if one doesn't exist
- See Also:
getValue()
,getPreviousValue()
-
getPreviousValue
Object getPreviousValue()
Return the object in the sequence that comes before the object returned bygetValue()
. If the end of the sequence has been reached then return null. Calling this method does not effectvalue
.- Returns:
- the previous legal value or null if one doesn't exist
- See Also:
getValue()
,getNextValue()
-
addChangeListener
void addChangeListener(ChangeListener l)
Adds aChangeListener
to the model's listener list. TheChangeListeners
must be notified when modelsvalue
changes.- Parameters:
l
- the ChangeListener to add- See Also:
removeChangeListener(javax.swing.event.ChangeListener)
-
removeChangeListener
void removeChangeListener(ChangeListener l)
Removes aChangeListener
from the model's listener list.- Parameters:
l
- the ChangeListener to remove- See Also:
addChangeListener(javax.swing.event.ChangeListener)
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
28/12/2024 08:56:02 Cette version de la page est en cache (à la date du 28/12/2024 08:56:02) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 29/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/SpinnerModel.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.