All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.basic.Spinner

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

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


Variable Index

 o ascent
 o backgroundColor
 o borderPainted
 o d
 o digitsTyped
 o fm
 o haveFocus
 o leadingPad
 o maxValue
 o minValue
 o nDigits
 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 fireAdjustmentValueChanged(AdjustmentEvent)
 o focusGained(FocusEvent)
 o focusLost(FocusEvent)
 o getBackgroundColor()
 o getBlockIncrement()
Does nothing -- part of the Adjustable interface.
 o getDigits()
 o getLeadingPad()
 o getMaximum()
Gets the maximum value of the Spinner.
 o getMinimum()
Gets the minimum value of the Spinner.
 o getOrientation()
Does nothing -- part of the Adjustable interface.
 o getText()
 o getUI()
 o getUIClassID()
 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 Component has the keyboard focus.
 o isBorderPainted()
 o isFocusTraversable()
Identifies whether or not this component can receive the focus.
 o keyPressed(KeyEvent)
 o keyReleased(KeyEvent)
 o keyTyped(KeyEvent)
 o mouseClicked(MouseEvent)
 o mouseEntered(MouseEvent)
 o mouseExited(MouseEvent)
 o mousePressed(MouseEvent)
 o mouseReleased(MouseEvent)
 o paintBorder(Graphics)
Paint the spinner's border if BorderPainted property is true.
 o removeAdjustmentListener(AdjustmentListener)
Removes an adjustment listener.
 o setBackgroundColor(Color)
 o setBlockIncrement(int)
Does nothing -- part of the Adjustable interface.
 o setBorderPainted(boolean)
 o setDigits(int)
 o setFont(Font)
 o setLeadingPad(int)
 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 setUI(SpinnerUI)
 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 updateUI()
Notification from the UIFactory that the L&F has changed.

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 fm
 protected FontMetrics fm
 o nDigits
 protected int nDigits
 o digitsTyped
 protected int digitsTyped
 o wraps
 protected boolean wraps
 o borderPainted
 protected boolean borderPainted
 o backgroundColor
 protected Color backgroundColor
 o leadingPad
 protected int leadingPad
 o wrapped
 public boolean wrapped

Constructors

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

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 setLeadingPad
 public void setLeadingPad(int newPad)
 o getLeadingPad
 public int getLeadingPad()
 o setBackgroundColor
 public void setBackgroundColor(Color newColor)
 o getBackgroundColor
 public Color getBackgroundColor()
 o isFocusTraversable
 public boolean isFocusTraversable()
Identifies whether or not this component can receive the focus.

Overrides:
isFocusTraversable in class JComponent
 o hasFocus
 public boolean hasFocus()
Returns true if this Component has the keyboard focus.

Overrides:
hasFocus in class JComponent
 o isBorderPainted
 public boolean isBorderPainted()
 o setBorderPainted
 public void setBorderPainted(boolean b)
 o 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
 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 fireAdjustmentValueChanged
 protected void fireAdjustmentValueChanged(AdjustmentEvent e)
 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.

 o keyTyped
 public void keyTyped(KeyEvent e)
 o keyPressed
 public void keyPressed(KeyEvent e)
 o keyReleased
 public void keyReleased(KeyEvent e)
 o mouseClicked
 public void mouseClicked(MouseEvent e)
 o mousePressed
 public void mousePressed(MouseEvent e)
 o mouseReleased
 public void mouseReleased(MouseEvent e)
 o mouseEntered
 public void mouseEntered(MouseEvent e)
 o mouseExited
 public void mouseExited(MouseEvent e)
 o focusGained
 public void focusGained(FocusEvent e)
 o focusLost
 public void focusLost(FocusEvent e)
 o getUI
 public SpinnerUI getUI()
 o setUI
 public void setUI(SpinnerUI ui)
 o updateUI
 public void updateUI()
Notification from the UIFactory that the L&F has changed.

Overrides:
updateUI in class JComponent
 o getUIClassID
 public String getUIClassID()
Returns:
"SpinnerUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI

All Packages  Class Hierarchy  This Package  Previous  Next  Index