All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.swing.basic.Spinner
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.swing.JComponent
|
+----java.awt.swing.basic.Spinner
- public class Spinner
- extends JComponent
- implements Adjustable, AdjustmentListener, FocusListener, KeyListener, MouseListener
A typein field for an integer.
ascent-
backgroundColor-
borderPainted-
d-
digitsTyped-
fm-
haveFocus-
leadingPad-
maxValue-
minValue-
nDigits-
txt-
value-
wrapped-
wraps-
Spinner(int)
-
Spinner(int, String)
-
addAdjustmentListener(AdjustmentListener)
- Add a listener to recieve adjustment events when the value of
the Spinner changes.
adjustmentValueChanged(AdjustmentEvent)
- Spinners can both send and recieve AdjustmentEvents -- they
can be cascaded together for situations where there are multiple
ways to enter the same value (popup menu or typin number)
fireAdjustmentValueChanged(AdjustmentEvent)
-
focusGained(FocusEvent)
-
focusLost(FocusEvent)
-
getBackgroundColor()
-
getBlockIncrement()
- Does nothing -- part of the Adjustable interface.
getDigits()
-
getLeadingPad()
-
getMaximum()
- Gets the maximum value of the Spinner.
getMinimum()
- Gets the minimum value of the Spinner.
getOrientation()
- Does nothing -- part of the Adjustable interface.
getText()
-
getUI()
-
getUIClassID()
-
getUnitIncrement()
- Does nothing -- part of the Adjustable interface.
getValue()
- Gets the current value of the Spinner object.
getVisibleAmount()
- Does nothing -- part of the Adjustable interface.
getWrap()
-
hasFocus()
- Returns true if this Component has the keyboard focus.
isBorderPainted()
-
isFocusTraversable()
- Identifies whether or not this component can receive the focus.
keyPressed(KeyEvent)
-
keyReleased(KeyEvent)
-
keyTyped(KeyEvent)
-
mouseClicked(MouseEvent)
-
mouseEntered(MouseEvent)
-
mouseExited(MouseEvent)
-
mousePressed(MouseEvent)
-
mouseReleased(MouseEvent)
-
paintBorder(Graphics)
- Paint the spinner's border if BorderPainted property is true.
removeAdjustmentListener(AdjustmentListener)
- Removes an adjustment listener.
setBackgroundColor(Color)
-
setBlockIncrement(int)
- Does nothing -- part of the Adjustable interface.
setBorderPainted(boolean)
-
setDigits(int)
-
setFont(Font)
- Sets the font of this component.
setLeadingPad(int)
-
setMaximum(int)
- Sets the maximum value of the Spinner.
setMinimum(int)
- Sets the minimum value of the Spinner.
setText(String)
- A Spinner can have a string associated with it, which is placed
at the right of the number
setUI(SpinnerUI)
-
setUnitIncrement(int)
- Does nothing -- part of the Adjustable interface.
setValue(int)
- Sets the current value of the Spinner.
setVisibleAmount(int)
- Does nothing -- part of the Adjustable interface.
setWrap(boolean)
- A Spinner for which wrapping is true wraps around to the minimum
value when the maximum value is exceeded, and vice versa.
updateUI()
- Notification from the UIFactory that the L&F
has changed.
txt
protected String txt
d
protected Dimension d
ascent
protected int ascent
value
protected int value
haveFocus
protected boolean haveFocus
minValue
protected int minValue
maxValue
protected int maxValue
fm
protected FontMetrics fm
nDigits
protected int nDigits
digitsTyped
protected int digitsTyped
wraps
protected boolean wraps
borderPainted
protected boolean borderPainted
backgroundColor
protected Color backgroundColor
leadingPad
protected int leadingPad
wrapped
public boolean wrapped
Spinner
public Spinner(int startValue,
String t)
Spinner
public Spinner(int startValue)
getValue
public int getValue()
- Gets the current value of the Spinner object.
setValue
public void setValue(int v)
- Sets the current value of the Spinner. This
value must be within the range defined by the minimum and
maximum values for this object.
- Parameters:
- v - the current value
setWrap
public void setWrap(boolean w)
- A Spinner for which wrapping is true wraps around to the minimum
value when the maximum value is exceeded, and vice versa.
- Parameters:
- w - true if wrapping is to be enabled, false if the
value is to be clamped.
getWrap
public boolean getWrap()
setText
public void setText(String s)
- A Spinner can have a string associated with it, which is placed
at the right of the number
- Parameters:
- s - the new text value
getText
public String getText()
setFont
public void setFont(Font f)
- Sets the font of this component.
- Overrides:
- setFont in class Component
setDigits
public void setDigits(int n)
getDigits
public int getDigits()
setLeadingPad
public void setLeadingPad(int newPad)
getLeadingPad
public int getLeadingPad()
setBackgroundColor
public void setBackgroundColor(Color newColor)
getBackgroundColor
public Color getBackgroundColor()
isFocusTraversable
public boolean isFocusTraversable()
- Identifies whether or not this component can receive the focus.
- Overrides:
- isFocusTraversable in class JComponent
hasFocus
public boolean hasFocus()
- Returns true if this Component has the keyboard focus.
- Overrides:
- hasFocus in class JComponent
isBorderPainted
public boolean isBorderPainted()
setBorderPainted
public void setBorderPainted(boolean b)
paintBorder
protected void paintBorder(Graphics g)
- Paint the spinner's border if BorderPainted property is true.
- Overrides:
- paintBorder in class JComponent
- See Also:
- paint, setBorder
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent e)
- Spinners can both send and recieve AdjustmentEvents -- they
can be cascaded together for situations where there are multiple
ways to enter the same value (popup menu or typin number)
setMinimum
public void setMinimum(int min)
- Sets the minimum value of the Spinner.
- Parameters:
- min - the minimum value
getMinimum
public int getMinimum()
- Gets the minimum value of the Spinner.
setMaximum
public void setMaximum(int max)
- Sets the maximum value of the Spinner.
- Parameters:
- max - the maximum value
getMaximum
public int getMaximum()
- Gets the maximum value of the Spinner.
addAdjustmentListener
public void addAdjustmentListener(AdjustmentListener l)
- Add a listener to recieve adjustment events when the value of
the Spinner changes.
- Parameters:
- l - the listener to recieve events
- See Also:
- AdjustmentEvent
removeAdjustmentListener
public void removeAdjustmentListener(AdjustmentListener l)
- Removes an adjustment listener.
- Parameters:
- l - the listener being removed
- See Also:
- AdjustmentEvent
fireAdjustmentValueChanged
protected void fireAdjustmentValueChanged(AdjustmentEvent e)
setUnitIncrement
public void setUnitIncrement(int u)
- Does nothing -- part of the Adjustable interface.
- Parameters:
- u - the unit increment
getUnitIncrement
public int getUnitIncrement()
- Does nothing -- part of the Adjustable interface.
setBlockIncrement
public void setBlockIncrement(int b)
- Does nothing -- part of the Adjustable interface.
- Parameters:
- b - the block increment
getBlockIncrement
public int getBlockIncrement()
- Does nothing -- part of the Adjustable interface.
setVisibleAmount
public void setVisibleAmount(int v)
- Does nothing -- part of the Adjustable interface.
- Parameters:
- v - the length of the indicator
getVisibleAmount
public int getVisibleAmount()
- Does nothing -- part of the Adjustable interface.
getOrientation
public int getOrientation()
- Does nothing -- part of the Adjustable interface.
keyTyped
public void keyTyped(KeyEvent e)
keyPressed
public void keyPressed(KeyEvent e)
keyReleased
public void keyReleased(KeyEvent e)
mouseClicked
public void mouseClicked(MouseEvent e)
mousePressed
public void mousePressed(MouseEvent e)
mouseReleased
public void mouseReleased(MouseEvent e)
mouseEntered
public void mouseEntered(MouseEvent e)
mouseExited
public void mouseExited(MouseEvent e)
focusGained
public void focusGained(FocusEvent e)
focusLost
public void focusLost(FocusEvent e)
getUI
public SpinnerUI getUI()
setUI
public void setUI(SpinnerUI ui)
updateUI
public void updateUI()
- Notification from the UIFactory that the L&F
has changed.
- Overrides:
- updateUI in class JComponent
getUIClassID
public String getUIClassID()
- Returns:
- "SpinnerUI"
- Overrides:
- getUIClassID in class JComponent
- See Also:
- getUIClassID, getUI
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature