gui.date
Class CyclingSpinnerListModel

java.lang.Object
  extended by javax.swing.AbstractSpinnerModel
      extended by javax.swing.SpinnerListModel
          extended by gui.date.CyclingSpinnerListModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.SpinnerModel

public class CyclingSpinnerListModel
extends javax.swing.SpinnerListModel

This example implements a SpinnerListModel that works only with an Object array and that implements cycling (the next value and previous value are never null). It also lets you optionally associate a spinner model that's linked to this one, so that when a cycle occurs the linked spinner model is updated. The SpinnerDemos use the CyclingSpinnerListModel for a month spinner that (in RunDatePanel) is tied to the year spinner, so that -- for example -- when the month changes from December to January, the year increases.

See Also:
Serialized Form

Constructor Summary
CyclingSpinnerListModel(java.lang.Object[] values)
           
 
Method Summary
 java.lang.Object getNextValue()
           
 java.lang.Object getPreviousValue()
           
 void setLinkedModel(javax.swing.SpinnerModel linkedModel)
           
 
Methods inherited from class javax.swing.SpinnerListModel
getList, getValue, setList, setValue
 
Methods inherited from class javax.swing.AbstractSpinnerModel
addChangeListener, getChangeListeners, getListeners, removeChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CyclingSpinnerListModel

public CyclingSpinnerListModel(java.lang.Object[] values)
Method Detail

setLinkedModel

public void setLinkedModel(javax.swing.SpinnerModel linkedModel)

getNextValue

public java.lang.Object getNextValue()
Specified by:
getNextValue in interface javax.swing.SpinnerModel
Overrides:
getNextValue in class javax.swing.SpinnerListModel

getPreviousValue

public java.lang.Object getPreviousValue()
Specified by:
getPreviousValue in interface javax.swing.SpinnerModel
Overrides:
getPreviousValue in class javax.swing.SpinnerListModel