|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.AbstractSpinnerModel
javax.swing.SpinnerNumberModel
gui.buttons.MinMaxSpinnerModel
public class MinMaxSpinnerModel
Spinner model that allows the user to specify minimum and maximum input values, for example
to define a range for an Axis
}.
This spinnermodel is designed to be used with a pair of spinners.
One spinner lets the user specify the maximum value of a range and the other spinner lets him specify the minimum value. Both spinners are limited within the range provided in the constructor arguments min and max.
However, in order to function correctly, each spinner also needs a reference to its counterpart in order to make sure that the min value spinner does not allow the user to choose a value that is larger than the one set in the max value spinner and vice versa. Through this setting, the spinner also understands whether it is a lower bound or an upper bound spinner, because it is only provided with a reference to the opposite spinner.
Field Summary | |
---|---|
private javax.swing.JSpinner |
lowerBoundSpinner
Reference to the lower bound spinner. |
private int |
max
The maximum value. |
private int |
min
The minimum value. |
(package private) static long |
serialVersionUID
The version tracking unique identifier for Serialization. |
private javax.swing.JSpinner |
upperBoundSpinner
Reference to the upper bound spinner. |
Fields inherited from class javax.swing.AbstractSpinnerModel |
---|
listenerList |
Constructor Summary | |
---|---|
MinMaxSpinnerModel(int min,
int max)
Instantiates a new min max spinner model. |
Method Summary | |
---|---|
void |
setLowerBoundSpinner(javax.swing.JSpinner lowerBoundSpinner)
Sets the lower bound spinner. |
void |
setUpperBoundSpinner(javax.swing.JSpinner upperBoundSpinner)
Sets the upper bound spinner. |
void |
setValue(java.lang.Object value)
|
Methods inherited from class javax.swing.SpinnerNumberModel |
---|
getMaximum, getMinimum, getNextValue, getNumber, getPreviousValue, getStepSize, getValue, setMaximum, setMinimum, setStepSize |
Methods inherited from class javax.swing.AbstractSpinnerModel |
---|
addChangeListener, fireStateChanged, getChangeListeners, getListeners, removeChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
private int min
private int max
private javax.swing.JSpinner upperBoundSpinner
private javax.swing.JSpinner lowerBoundSpinner
Constructor Detail |
---|
public MinMaxSpinnerModel(int min, int max)
min
- the minmax
- the maxMethod Detail |
---|
public void setValue(java.lang.Object value)
setValue
in interface javax.swing.SpinnerModel
setValue
in class javax.swing.SpinnerNumberModel
public void setLowerBoundSpinner(javax.swing.JSpinner lowerBoundSpinner)
lowerBoundSpinner
- the new lower bound spinnerpublic void setUpperBoundSpinner(javax.swing.JSpinner upperBoundSpinner)
upperBoundSpinner
- the new upper bound spinner
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |