|
||||||||||
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.JPanel
edu.wisc.ssec.mcidasv.data.dateChooser.JSpinField
public class JSpinField
JSpinField is a numeric field with 2 spin buttons to increase or decrease the value. It has the same interface as the "old" JSpinField but uses a JSpinner internally (since J2SE SDK 1.4) rather than a scrollbar for emulating the spin buttons.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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 Color |
darkGreen
|
protected int |
max
|
protected int |
min
|
private static long |
serialVersionUID
|
protected JSpinner |
spinner
|
protected JTextField |
textField
the text (number) field |
protected int |
value
|
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 | |
---|---|
JSpinField()
Default JSpinField constructor. |
|
JSpinField(int min,
int max)
JSpinField constructor with given minimum and maximum vaues and initial value 0. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
After any user input, the value of the textfield is proofed. |
void |
adjustWidthToMaximumValue()
|
void |
caretUpdate(CaretEvent e)
After any user input, the value of the textfield is proofed. |
void |
focusGained(FocusEvent e)
|
void |
focusLost(FocusEvent e)
The value of the text field is checked against a valid (green) value. |
int |
getMaximum()
Returns the maximum value. |
int |
getMinimum()
Returns the minimum value. |
Component |
getSpinner()
Returns the year chooser's spinner (which allow the focus to be set to it). |
int |
getValue()
Returns the value. |
static void |
main(String[] s)
Creates a JFrame with a JSpinField inside and can be used for testing. |
void |
setEnabled(boolean enabled)
Enable or disable the JSpinField. |
void |
setFont(Font font)
Sets the font property. |
void |
setForeground(Color fg)
Sets the foreground |
void |
setHorizontalAlignment(int alignment)
Sets the horizontal alignment of the displayed value. |
void |
setMaximum(int newMaximum)
Sets the maximum value and adjusts the preferred width. |
void |
setMinimum(int newMinimum)
Sets the minimum value. |
void |
setValue(int newValue)
Sets the value. |
protected void |
setValue(int newValue,
boolean updateTextField,
boolean firePropertyChange)
Sets the value attribute of the JSpinField object. |
void |
stateChanged(ChangeEvent e)
Is invoked when the spinner model changes |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
protected JSpinner spinner
protected JTextField textField
protected int min
protected int max
protected int value
protected Color darkGreen
Constructor Detail |
---|
public JSpinField()
public JSpinField(int min, int max)
Method Detail |
---|
public void adjustWidthToMaximumValue()
public void stateChanged(ChangeEvent e)
stateChanged
in interface ChangeListener
e
- the ChangeEventprotected void setValue(int newValue, boolean updateTextField, boolean firePropertyChange)
newValue
- The new valueupdateTextField
- true if text field should be updatedpublic void setValue(int newValue)
newValue
- the new valuegetValue()
public int getValue()
public void setMinimum(int newMinimum)
newMinimum
- the new minimum valuegetMinimum()
public int getMinimum()
public void setMaximum(int newMaximum)
newMaximum
- the new maximum valuegetMaximum()
public void setHorizontalAlignment(int alignment)
alignment
- the horizontal alignmentpublic int getMaximum()
public void setFont(Font font)
setFont
in class JComponent
font
- the new fontpublic void setForeground(Color fg)
setForeground
in class JComponent
fg
- the foregroundpublic void caretUpdate(CaretEvent e)
caretUpdate
in interface CaretListener
e
- the caret eventpublic void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
e
- Description of the Parameterpublic void setEnabled(boolean enabled)
setEnabled
in class JComponent
enabled
- The new enabled valuepublic Component getSpinner()
public static void main(String[] s)
s
- The command line argumentspublic void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |