|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JSpinner
jview.MySpinner
public class MySpinner
This spinner fires an action event when it comes to rest. It is based on JSpinner arrow listener. Additionally, it does away with some very stupid implementation in the classic spinner, e.g. setting a step width that is smaller than the number of digits displayed in the default formatter now work. Nevertheless, the entire API is somehow spoilt, so this workaropund does not work if the model is extracted later from the spinner.
| Nested Class Summary | |
|---|---|
(package private) class |
MySpinner.MyUI
|
static class |
MySpinner.ResetButton
Based loosely on BasicArrowButton. |
static class |
MySpinner.Show
Test class for display. |
| Nested classes/interfaces inherited from class javax.swing.JSpinner |
|---|
JSpinner.AccessibleJSpinner, JSpinner.DateEditor, JSpinner.DefaultEditor, JSpinner.ListEditor, JSpinner.NumberEditor |
| 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 | |
|---|---|
(package private) JButton |
btnDown
|
(package private) JButton |
btnUp
|
static String |
BUTTON
Property name for reset button. |
private Object |
firstval
|
static String |
LABEL
Property name for label. |
| 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 | |
|---|---|
MySpinner()
|
|
MySpinner(SpinnerNumberModel sm)
|
|
| Method Summary | |
|---|---|
private void |
adaptFormat(Number stepsize)
We set the number format to be used along with the editor text field to have at least the number of digits the step-size implies. |
void |
addActionListener(ActionListener al)
|
void |
removeActionListener(ActionListener al)
|
Object |
resetToOriginalValue()
This sets the spinner value to the first explicetly set value. |
void |
setActionCommand(String name)
|
void |
setStepSize(Object s)
We allow setting the step size explicetly, instead of catching change events on the spinner model itself. |
void |
setValue(Object to)
We cache the first call to this method's value. |
boolean |
wasDown(ActionEvent ae)
If this action event was generated by the button down, return true. |
boolean |
wasUp(ActionEvent ae)
If this action event was generated by the button down, return true. |
| Methods inherited from class javax.swing.JSpinner |
|---|
addChangeListener, commitEdit, createEditor, fireStateChanged, getAccessibleContext, getChangeListeners, getEditor, getModel, getNextValue, getPreviousValue, getUI, getUIClassID, getValue, removeChangeListener, setEditor, setModel, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String LABEL
public static final String BUTTON
JButton btnUp
JButton btnDown
private Object firstval
| Constructor Detail |
|---|
public MySpinner()
public MySpinner(SpinnerNumberModel sm)
| Method Detail |
|---|
public void setActionCommand(String name)
public void addActionListener(ActionListener al)
public void removeActionListener(ActionListener al)
public boolean wasUp(ActionEvent ae)
public Object resetToOriginalValue()
public void setValue(Object to)
setValue in class JSpinnerpublic void setStepSize(Object s)
getModel().setStepSize() will not alter the
step-size formatter. Additionally, we set the column number in the text
field to hold at least the number of columns we need.
private void adaptFormat(Number stepsize)
public boolean wasDown(ActionEvent ae)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||