|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent dsto.dfc.swing.controls.NumericSpinner
public class NumericSpinner
A spinner component for numeric values stored in a BoundedRangeModel object. Provides a text field for numeric entry and increment/decrement buttons.
BoundedRangeModel
,
Serialized FormNested Class Summary | |
---|---|
protected class |
NumericSpinner.ArrowButton
A small extension of JButton to implement arrow buttons. |
protected class |
NumericSpinner.BoundedRangeModelChangeListener
|
protected class |
NumericSpinner.ButtonChangeListener
Listens for changes to the arrow button models and timer ticks that signal auto repeats when buttons are held down. |
protected class |
NumericSpinner.LayoutManager
Custom layout manager for NumericSpinner. |
protected class |
NumericSpinner.TextFieldListener
|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected NumericSpinner.BoundedRangeModelChangeListener |
boundedRangeModelChangeListener
|
protected static Insets |
buttonMargin
|
protected boolean |
changing
|
protected NumericSpinner.ArrowButton |
downButton
|
protected int |
increment
|
protected static int |
MIN_ARROW_HEIGHT
|
protected static int |
MIN_BUTTON_WIDTH
|
protected BoundedRangeModel |
model
|
protected JTextField |
textField
|
protected NumericSpinner.ArrowButton |
upButton
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
NumericSpinner()
Creates a default spinner with min = 0, max = 100, value = 50. |
|
NumericSpinner(BoundedRangeModel model)
Creates a spinner using model as the model. |
|
NumericSpinner(int minimum,
int maximum,
int value)
Creates a numeric spinner with a default model intialised to minimum, maximum and value. |
Method Summary | |
---|---|
void |
addActionListener(ActionListener l)
Add an ActionListener, by passing it onto the TextField. |
protected void |
doIncrement(int newIncrement)
Perform an increment operation. |
int |
getIncrement()
Returns the amount by which the value is increased/decreased by clicking on the arrow buttons. |
int |
getMaximum()
Get the current maximum value. |
int |
getMinimum()
Get the current minimum value. |
BoundedRangeModel |
getModel()
Returns the model currently being used by the spinner. |
int |
getValue()
Get the current value. |
protected void |
init()
Performs common initialisation of the spinner. |
protected void |
loadModelFromTextField()
Loads the model from the text field. |
protected void |
loadTextFieldFromModel()
Loads the text field value from the model. |
void |
removeActionListener(ActionListener l)
Remove the ActionListener, by telling the TextField to remove it. |
void |
setEnabled(boolean enabled)
Set the textfield and the arrow buttons to be enabled/disabled |
void |
setIncrement(int increment)
Sets the amount by which the value is increased/decreased by clicking on the arrow buttons. |
void |
setMaximum(int maximum)
Set the current model value. |
void |
setMinimum(int minimum)
Set the current minimum value. |
void |
setModel(BoundedRangeModel model)
Sets the model to be used by the spinner. |
void |
setToolTipText(String text)
|
void |
setValue(int value)
Set the current value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int MIN_ARROW_HEIGHT
protected static final int MIN_BUTTON_WIDTH
protected static final Insets buttonMargin
protected BoundedRangeModel model
protected JTextField textField
protected NumericSpinner.ArrowButton upButton
protected NumericSpinner.ArrowButton downButton
protected int increment
protected transient boolean changing
protected NumericSpinner.BoundedRangeModelChangeListener boundedRangeModelChangeListener
Constructor Detail |
---|
public NumericSpinner()
public NumericSpinner(BoundedRangeModel model)
model
as the model.
getModel()
,
setModel(javax.swing.BoundedRangeModel)
public NumericSpinner(int minimum, int maximum, int value)
getModel()
,
setModel(javax.swing.BoundedRangeModel)
Method Detail |
---|
public void addActionListener(ActionListener l)
public void removeActionListener(ActionListener l)
public void setEnabled(boolean enabled)
setEnabled
in class JComponent
enabled
- Enable the textfield and arrow buttons.public int getValue()
public void setValue(int value)
value
- The new value.public int getMinimum()
public void setMinimum(int minimum)
minimum
- The new minimum value.public int getMaximum()
public void setMaximum(int maximum)
maximum
- The new maximum value.public int getIncrement()
setIncrement(int)
public void setIncrement(int increment)
increment
- The new increment value.getIncrement()
public BoundedRangeModel getModel()
setModel(javax.swing.BoundedRangeModel)
public void setModel(BoundedRangeModel model)
model
- The new model.getModel()
public void setToolTipText(String text)
setToolTipText
in class JComponent
protected void init()
protected void doIncrement(int newIncrement)
newIncrement
- The amount to increase/decrease the current
value by.protected void loadTextFieldFromModel()
changing
to prevent circular change event
propagation.
loadModelFromTextField()
protected void loadModelFromTextField()
changing
to prevent circular change event propagation.
loadTextFieldFromModel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |