javax.swing
Class SpinnerNumberModel
- Serializable, SpinnerModel
SpinnerNumberModel() - Creates a
SpinnerNumberModel with initial value 0, step 1,
and no maximum nor minimum.
|
SpinnerNumberModel(double value, double minimum, double maximum, double stepSize) - Creates a
SpinnerNumberModel with double precision.
|
SpinnerNumberModel(int value, int minimum, int maximum, int stepSize) - Creates a
SpinnerNumberModel with integer precision.
|
SpinnerNumberModel(Number value, Comparable<T> minimum, Comparable<T> maximum, Number stepSize) - Creates a
SpinnerNumberModel with the given attributes.
|
Comparable<T> | getMaximum() - Returns the maximum value, or
null if there is no maximum.
|
Comparable<T> | getMinimum() - Returns the minimum value, or
null if there is no minimum.
|
Object | getNextValue() - Returns the next value, or
null if adding the step size to
the current value results in a value greater than the maximum value.
|
Number | getNumber() - Returns the current value.
|
Object | getPreviousValue() - Returns the previous value, or
null if subtracting the
step size from the current value results in a value less than the minimum
value.
|
Number | getStepSize() - Returns the step size.
|
Object | getValue() - Returns the current value, which for this class is always an instance of
Number .
|
void | setMaximum(Comparable<T> newMaximum) - Sets the maximum value and, if the new value is different to the old
value, sends a
ChangeEvent to all registered listeners.
|
void | setMinimum(Comparable<T> newMinimum) - Sets the minimum value and, if the new value is different to the old
value, sends a
ChangeEvent to all registered listeners.
|
void | setStepSize(Number newStepSize) - Sets the step size and, if the new step size is different to the old
step size, sends a
ChangeEvent to all registered listeners.
|
void | setValue(Object value) - Sets the current value and, if the new value is different to the old
value, sends a
ChangeEvent to all registered listeners.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
SpinnerNumberModel
public SpinnerNumberModel()
Creates a SpinnerNumberModel
with initial value 0, step 1,
and no maximum nor minimum.
SpinnerNumberModel
public SpinnerNumberModel(double value,
double minimum,
double maximum,
double stepSize)
Creates a SpinnerNumberModel
with double precision.
value
- the initial valueminimum
- the minimum valuemaximum
- the maximum valuestepSize
- the step size
SpinnerNumberModel
public SpinnerNumberModel(int value,
int minimum,
int maximum,
int stepSize)
Creates a SpinnerNumberModel
with integer precision.
value
- the initial valueminimum
- the minimum valuemaximum
- the maximum valuestepSize
- the step size
SpinnerNumberModel
public SpinnerNumberModel(Number value,
Comparable<T> minimum,
Comparable<T> maximum,
Number stepSize)
Creates a SpinnerNumberModel
with the given attributes. The
caller should ensure that both minimum
and
maximum
are serializable.
value
- the initial value (null
not permitted).minimum
- the minimum value (null
permitted).maximum
- the maximum value (null
permitted).stepSize
- the step size (null
not permitted).
getNextValue
public Object getNextValue()
Returns the next value, or null
if adding the step size to
the current value results in a value greater than the maximum value.
The current value is not changed.
- getNextValue in interface SpinnerModel
- The next value, or
null
if the current value is the
maximum value represented by this model.
getPreviousValue
public Object getPreviousValue()
Returns the previous value, or null
if subtracting the
step size from the current value results in a value less than the minimum
value. The current value is not changed.
- getPreviousValue in interface SpinnerModel
- The previous value, or
null
if the current value
is the minimum value represented by this model.
getStepSize
public Number getStepSize()
Returns the step size.
- The step size (never
null
).
setMaximum
public void setMaximum(Comparable<T> newMaximum)
Sets the maximum value and, if the new value is different to the old
value, sends a
ChangeEvent
to all registered listeners. A
null
value is interpreted as "no maximum value". No check
is made to ensure that the new maximum is greater than or equal to the
current value, the caller is responsible for ensuring that this
relationship holds. In addition, the caller should ensure that
newMaximum
is
Serializable
.
newMaximum
- the new maximum (null
permitted).
setMinimum
public void setMinimum(Comparable<T> newMinimum)
Sets the minimum value and, if the new value is different to the old
value, sends a
ChangeEvent
to all registered listeners. A
null
value is interpreted as "no minimum value". No check
is made to ensure that the new minimum is less than or equal to the
current value, the caller is responsible for ensuring that this
relationship holds. In addition, the caller should ensure that
newMinimum
is
Serializable
.
newMinimum
- the new minimum value (null
permitted).
setStepSize
public void setStepSize(Number newStepSize)
Sets the step size and, if the new step size is different to the old
step size, sends a
ChangeEvent
to all registered listeners.
newStepSize
- the new step size (null
not permitted).
setValue
public void setValue(Object value)
Sets the current value and, if the new value is different to the old
value, sends a
ChangeEvent
to all registered listeners.
- setValue in interface SpinnerModel
value
- the new value (null
not permitted, must be an
instance of Number
).
SpinnerNumberModel.java --
Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.