buoy.widget
Class BSpinner
A BSpinner is a Widget that allows the user to select a value from an ordered sequence. It allows
the user to enter a value, and also provides a pair of arrows for stepping through the values in the
sequence.
The list of allowed values is determined by a
javax.swing.SpinnerModel
. BSpinner
provides constructors for handling the most common cases: a range of numbers, a date, or a fixed
list of objects. For other cases, you can explicitly set the model by calling
setModel()
,
or by using the constructor which takes a
SpinnerModel
.
In addition to the event types generated by all Widgets, BSpinners generate the following event types:
BSpinner() - Create a new BSpinner which allows the user to select an arbitrary integer.
|
BSpinner(Date date) - Create a new BSpinner which allows the user to select a date.
|
BSpinner(SpinnerModel model) - Create a new BSpinner.
|
BSpinner(double value, double min, double max, double step) - Create a new BSpinner which allows the user to select floating point numbers in a fixed range.
|
BSpinner(int value, int min, int max, int step) - Create a new BSpinner which allows the user to select integers in a fixed range.
|
BSpinner(values[] ) - Create a new BSpinner which allows the user to select from a fixed list of objects.
|
void | commitEdit() - If the user adjusts the spinner by typing a value (rather than clicking the arrows), the new
value is not actually parsed and "committed" until they press return.
|
SpinnerModel | getModel() - Get the model for this spinner.
|
Object | getValue() - Get the current value of the spinner.
|
void | setModel(SpinnerModel model) - Set the model for this spinner.
|
void | setValue(Object value) - Set the current value of the spinner.
|
addEventLink , dispatchEvent , getBackground , getBounds , getComponent , getCursor , getFont , getMaximumSize , getMinimumSize , getName , getParent , getPreferredSize , hasFocus , isEnabled , isFocusable , isVisible , repaint , requestFocus , setBackground , setCursor , setEnabled , setFocusable , setFont , setName , setVisible |
BSpinner
public BSpinner()
Create a new BSpinner which allows the user to select an arbitrary integer. The initial value
is 0.
BSpinner
public BSpinner(Date date)
Create a new BSpinner which allows the user to select a date.
BSpinner
public BSpinner(SpinnerModel model)
Create a new BSpinner.
model
- the model which specifies the values for the spinner.
BSpinner
public BSpinner(double value,
double min,
double max,
double step)
Create a new BSpinner which allows the user to select floating point numbers in a fixed range.
value
- the initial valuemin
- the minimum allowed valuemax
- the maximum allowed valuestep
- the amount by which the value changes when the user clicks the arrows
BSpinner
public BSpinner(int value,
int min,
int max,
int step)
Create a new BSpinner which allows the user to select integers in a fixed range.
value
- the initial valuemin
- the minimum allowed valuemax
- the maximum allowed valuestep
- the amount by which the value changes when the user clicks the arrows
BSpinner
public BSpinner(values[] )
Create a new BSpinner which allows the user to select from a fixed list of objects. The initial
value is the first element in the list.
commitEdit
public void commitEdit()
throws ParseException
If the user adjusts the spinner by typing a value (rather than clicking the arrows), the new
value is not actually parsed and "committed" until they press return. Call this method to
immediately commit an edited value.
Note: calling commitEdit() will
not generate a ValueChangedEvent.
getModel
public SpinnerModel getModel()
Get the model for this spinner.
getValue
public Object getValue()
Get the current value of the spinner.
setModel
public void setModel(SpinnerModel model)
Set the model for this spinner.
setValue
public void setValue(Object value)
Set the current value of the spinner.
Written by Peter Eastman.