All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.Spinner

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.Spinner

public class Spinner
extends JComponent
implements Adjustable, AdjustmentListener
A typein field for an integer.


Variable Index

 o ascent
 o d
 o digitsTyped
 o fm
 o haveFocus
 o maxValue
 o minValue
 o nDigits
 o target
 o txt
 o value
 o wrapped
 o wraps

Constructor Index

 o Spinner(int)
 o Spinner(int, String)

Method Index

 o addAdjustmentListener(AdjustmentListener)
Add a listener to recieve adjustment events when the value of the Spinner changes.
 o 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)
 o getBlockIncrement()
Does nothing -- part of the Adjustable interface.
 o getDigits()
 o getMaximum()
Gets the maximum value of the Spinner.
 o getMinimum()
Gets the minimum value of the Spinner.
 o getMinimumSize()
 o getOrientation()
Does nothing -- part of the Adjustable interface.
 o getPreferredSize()
 o getText()
 o getUnitIncrement()
Does nothing -- part of the Adjustable interface.
 o getValue()
Gets the current value of the Spinner object.
 o getVisibleAmount()
Does nothing -- part of the Adjustable interface.
 o getWrap()
 o hasFocus()
Returns true if this Container has the keyboard focus.
 o isFocusTraversable()
 o paint(Graphics)
 o processFocusEvent(FocusEvent)
 o processKeyEvent(KeyEvent)
Override processKeyEvent to process events
 o processMouseEvent(MouseEvent)
 o removeAdjustmentListener(AdjustmentListener)
Removes an adjustment listener.
 o setBlockIncrement(int)
Does nothing -- part of the Adjustable interface.
 o setDigits(int)
 o setFont(Font)
 o setMaximum(int)
Sets the maximum value of the Spinner.
 o setMinimum(int)
Sets the minimum value of the Spinner.
 o setText(String)
A Spinner can have a string associated with it, which is placed at the right of the number
 o setUnitIncrement(int)
Does nothing -- part of the Adjustable interface.
 o setValue(int)
Sets the current value of the Spinner.
 o setVisibleAmount(int)
Does nothing -- part of the Adjustable interface.
 o setWrap(boolean)
A Spinner for which wrapping is true wraps around to the minimum value when the maximum value is exceeded, and vice versa.
 o update(Graphics)

Variables

 o txt
 protected String txt
 o d
 protected Dimension d
 o ascent
 protected int ascent
 o value
 protected int value
 o haveFocus
 protected boolean haveFocus
 o minValue
 protected int minValue
 o maxValue
 protected int maxValue
 o target
 protected AdjustmentListener target
 o fm
 protected FontMetrics fm
 o nDigits
 protected int nDigits
 o digitsTyped
 protected int digitsTyped
 o wraps
 protected boolean wraps
 o wrapped
 public boolean wrapped

Constructors

 o Spinner
 public Spinner(int init,
                String t)
 o Spinner
 public Spinner(int init)

Methods

 o getValue
 public int getValue()
Gets the current value of the Spinner object.

 o 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
 o 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.
 o getWrap
 public boolean getWrap()
 o 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
 o getText
 public String getText()
 o setFont
 public void setFont(Font f)
Overrides:
setFont in class Component
 o setDigits
 public void setDigits(int n)
 o getDigits
 public int getDigits()
 o processFocusEvent
 protected void processFocusEvent(FocusEvent e)
Overrides:
processFocusEvent in class Component
 o processKeyEvent
 protected void processKeyEvent(KeyEvent e)
Override processKeyEvent to process events

Overrides:
processKeyEvent in class JComponent
 o processMouseEvent
 protected void processMouseEvent(MouseEvent e)
Overrides:
processMouseEvent in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent
 o getMinimumSize
 public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent
 o isFocusTraversable
 public boolean isFocusTraversable()
Overrides:
isFocusTraversable in class JComponent
 o hasFocus
 public boolean hasFocus()
Returns true if this Container has the keyboard focus.

Overrides:
hasFocus in class JComponent
 o paint
 public void paint(Graphics g)
Overrides:
paint in class JComponent
 o update
 public void update(Graphics g)
Overrides:
update in class Container
 o 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)

 o setMinimum
 public void setMinimum(int min)
Sets the minimum value of the Spinner.

Parameters:
min - the minimum value
 o getMinimum
 public int getMinimum()
Gets the minimum value of the Spinner.

 o setMaximum
 public void setMaximum(int max)
Sets the maximum value of the Spinner.

Parameters:
max - the maximum value
 o getMaximum
 public int getMaximum()
Gets the maximum value of the Spinner.

 o 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
 o removeAdjustmentListener
 public void removeAdjustmentListener(AdjustmentListener l)
Removes an adjustment listener.

Parameters:
l - the listener being removed
See Also:
AdjustmentEvent
 o setUnitIncrement
 public void setUnitIncrement(int u)
Does nothing -- part of the Adjustable interface.

Parameters:
u - the unit increment
 o getUnitIncrement
 public int getUnitIncrement()
Does nothing -- part of the Adjustable interface.

 o setBlockIncrement
 public void setBlockIncrement(int b)
Does nothing -- part of the Adjustable interface.

Parameters:
b - the block increment
 o getBlockIncrement
 public int getBlockIncrement()
Does nothing -- part of the Adjustable interface.

 o setVisibleAmount
 public void setVisibleAmount(int v)
Does nothing -- part of the Adjustable interface.

Parameters:
v - the length of the indicator
 o getVisibleAmount
 public int getVisibleAmount()
Does nothing -- part of the Adjustable interface.

 o getOrientation
 public int getOrientation()
Does nothing -- part of the Adjustable interface.


All Packages  Class Hierarchy  This Package  Previous  Next  Index