All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCSpinBox

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----jclass.bwt.JCContainer
                                   |
                                   +----jclass.bwt.JCSpinBox

public class JCSpinBox
extends JCContainer
implements KeyListener, JCActionListener
JCSpinBox provides the capabilities of an JCTextField and 2 JCArrowButtons. The user can choose from a range of numeric values.

By default, the text field is editable. If the user attempts to enter an invalid value, it is disallowed.

Properties

Name Method
AutoArrowDisable setAutoArrowDisable
Background setBackground
DecimalPlaces setDecimalPlaces
DoubleBuffer setDoubleBuffer
Font setFont
Foreground setForeground
Increment setIncrement
Insets setInsets
Maximum setMaximum
Minimum setMinimum
Position setPosition
PreferredSize setPreferredSize
UserData setUserData

Events

Class Listener Description
JCSpinBoxEvent addSpinBoxListener Posted when the user changes the value


Variable Index

 o DECREMENT
 o INCREMENT
 o listeners
List of JCSpinBoxEvent listeners
 o NONE
 o shadow
The container's shadow thickness.

Constructor Index

 o JCSpinBox()
Creates an empty SpinBox.
 o JCSpinBox(Applet, String)
Creates a SpinBox which reads parameters from the applet's HTML file.
 o JCSpinBox(int)
Creates an empty SpinBox with the specified number of columns.

Method Index

 o actionPerformed(JCActionEvent)
If an arrow button was pressed, calls setTextAction.
If the user changed the text field's value, calls validate.
 o addSpinBoxListener(JCSpinBoxListener)
Adds the specified JCSpinBoxEvent listener to receive value change events.
 o calcValue(int)
Gets the value to be displayed
 o enableArrowButtons()
Disables the arrow buttons if the end of the range is reached.
 o getAutoArrowDisable()
Gets the AutoArrowDisable value.
 o getDecimalPlaces()
Gets the DecimalPlaces value.
 o getDecimalPointChar()
Gets the decimal point char.
 o getDecrementArrow()
Gets the decrement (down) button.
 o getIncrement()
Gets the Increment value.
 o getIncrementArrow()
Gets the increment (up) button.
 o getIntValue()
Gets the current value as an int.
 o getMaximum()
Gets the Maximum value.
 o getMinimum()
Gets the Minimum value.
 o getParameters()
Reads the parameter values from the HTML page using the component's applet.
 o getPosition()
Gets the Position value.
 o getText()
Gets the value of the text.
 o getTextField()
Gets the component to be used as the data entry field.
 o getValue()
Gets the current value as a string.
 o initTextValue()
Sets the text field's initial value.
 o keyPressed(KeyEvent)
 o keyReleased(KeyEvent)
 o keyTyped(KeyEvent)
 o layout()
Positions the text field and arrow buttons.
 o paintInterior(Graphics)
Draws the shadows.
 o postSpinBoxEvent(int, Object)
Posts a JCSpinBoxEvent
 o preferredHeight()
Returns the text field's preferred height.
 o preferredWidth()
Returns the sum of the text field's and arrow button's preferred widths.
 o removeSpinBoxListener(JCSpinBoxListener)
Removes the specified listener so it no longer receives JCSpinBoxEvents.
 o setAutoArrowDisable(boolean)
If true (default), the increment or decrement arrow button is disabled when the end of the range is reached.
 o setDecimalPlaces(int)
Sets the number of decimal points used when displaying the value (default: 0).

HTML param name/value: "DecimalPlaces"/int

 o setIncrement(int)
Sets the amount by which to increment or decrement the value (default: 1).

HTML param name/value: "Increment"/int

 o setIntValue(int)
Sets the current value as an int.
 o setLayout(LayoutManager)
Sets the layout manager for this container.
 o setMaximum(int)
Sets the highest possible value (default: BWTEnum.MAXINT).

HTML param name/value: "Maximum"/int

 o setMinimum(int)
Sets the lowest possible value (default: 0).

HTML param name/value: "Minimum"/int

 o setPosition(int)
Sets the position of the currently displayed item (default: 0) (the position in the range of possible values).
 o setText(String)
Sets the text field's value to the specified string.

HTML param name/value: "Text"/string

 o setTextAction(int)
Sets the text field's value after an arrow key is hit.
 o setTextValue(Object)
Sets the text field's value.
 o validate(Object)
Validates the text field's value after the user has changed it.

Variables

 o shadow
  protected int shadow
The container's shadow thickness.

 o NONE
  protected final static int NONE
 o INCREMENT
  protected final static int INCREMENT
 o DECREMENT
  protected final static int DECREMENT
 o listeners
  protected JCVector listeners
List of JCSpinBoxEvent listeners

Constructors

 o JCSpinBox
  public JCSpinBox()
Creates an empty SpinBox. No parameters are read from an HTML file.

 o JCSpinBox
  public JCSpinBox(int cols)
Creates an empty SpinBox with the specified number of columns. No parameters are read from an HTML file.

 o JCSpinBox
  public JCSpinBox(Applet applet,
                   String name)
Creates a SpinBox which reads parameters from the applet's HTML file.

Parameters:
applet - the applet whose PARAM tags are to be read
name - if this is not null, only parameters preceded by this name are read
See Also:
getParam

Methods

 o getParameters
  protected void getParameters()
Reads the parameter values from the HTML page using the component's applet. The values will override those previously set.

Overrides:
getParameters in class JCContainer
 o getTextField
  public JCTextField getTextField()
Gets the component to be used as the data entry field.

 o getDecrementArrow
  public JCArrowButton getDecrementArrow()
Gets the decrement (down) button.

 o getIncrementArrow
  public JCArrowButton getIncrementArrow()
Gets the increment (up) button.

 o getAutoArrowDisable
  public boolean getAutoArrowDisable()
Gets the AutoArrowDisable value.

See Also:
setAutoArrowDisable
 o setAutoArrowDisable
  public void setAutoArrowDisable(boolean v)
If true (default), the increment or decrement arrow button is disabled when the end of the range is reached. If set to false, the buttons are always enabled.

HTML param name/value: "AutoArrowDisable"/boolean

 o getDecimalPlaces
  public int getDecimalPlaces()
Gets the DecimalPlaces value.

See Also:
setDecimalPlaces
 o setDecimalPlaces
  public void setDecimalPlaces(int v)
Sets the number of decimal points used when displaying the value (default: 0).

HTML param name/value: "DecimalPlaces"/int

 o getIncrement
  public int getIncrement()
Gets the Increment value.

See Also:
setIncrement
 o setIncrement
  public void setIncrement(int v)
Sets the amount by which to increment or decrement the value (default: 1).

HTML param name/value: "Increment"/int

 o getMinimum
  public int getMinimum()
Gets the Minimum value.

See Also:
setMinimum
 o setMinimum
  public void setMinimum(int v)
Sets the lowest possible value (default: 0).

HTML param name/value: "Minimum"/int

 o getMaximum
  public int getMaximum()
Gets the Maximum value.

See Also:
setMaximum
 o setMaximum
  public void setMaximum(int v)
Sets the highest possible value (default: BWTEnum.MAXINT).

HTML param name/value: "Maximum"/int

 o getPosition
  public int getPosition()
Gets the Position value.

See Also:
setPosition
 o setPosition
  public void setPosition(int v)
Sets the position of the currently displayed item (default: 0) (the position in the range of possible values). HTML param name/value: "Position"/int

 o getIntValue
  public int getIntValue()
Gets the current value as an int.

 o setIntValue
  public void setIntValue(int v)
Sets the current value as an int.

 o getValue
  public String getValue()
Gets the current value as a string.

 o setText
  public synchronized void setText(String s)
Sets the text field's value to the specified string.

HTML param name/value: "Text"/string

 o getText
  public synchronized String getText()
Gets the value of the text.

See Also:
setText
 o addSpinBoxListener
  public void addSpinBoxListener(JCSpinBoxListener l)
Adds the specified JCSpinBoxEvent listener to receive value change events.

See Also:
JCSpinBoxEvent
 o removeSpinBoxListener
  public void removeSpinBoxListener(JCSpinBoxListener l)
Removes the specified listener so it no longer receives JCSpinBoxEvents.

See Also:
addSpinBoxListener
 o preferredWidth
  protected int preferredWidth()
Returns the sum of the text field's and arrow button's preferred widths.

Overrides:
preferredWidth in class JCContainer
 o preferredHeight
  protected int preferredHeight()
Returns the text field's preferred height.

Overrides:
preferredHeight in class JCContainer
 o layout
  public synchronized void layout()
Positions the text field and arrow buttons.

Overrides:
layout in class Container
 o paintInterior
  public void paintInterior(Graphics gc)
Draws the shadows.

Overrides:
paintInterior in class JCContainer
 o postSpinBoxEvent
  protected JCSpinBoxEvent postSpinBoxEvent(int stage,
                                            Object value)
Posts a JCSpinBoxEvent

Returns:
the posted event, or null if there are no listeners
See Also:
addSpinBoxListener, JCSpinBoxEvent
 o getDecimalPointChar
  protected char getDecimalPointChar()
Gets the decimal point char.

 o calcValue
  protected Object calcValue(int dir)
Gets the value to be displayed

Parameters:
dir - INCREMENT, DECREMENT or NONE
 o initTextValue
  protected void initTextValue()
Sets the text field's initial value.

 o setTextValue
  protected void setTextValue(Object value)
Sets the text field's value.

 o setTextAction
  public void setTextAction(int dir)
Sets the text field's value after an arrow key is hit.

Parameters:
dir - INCREMENT, DECREMENT or NONE
 o enableArrowButtons
  protected void enableArrowButtons()
Disables the arrow buttons if the end of the range is reached.

See Also:
setAutoArrowDisable
 o validate
  protected boolean validate(Object value)
Validates the text field's value after the user has changed it. If the value is valid, the position is determined.

Returns:
false if the value is invalid
See Also:
setPosition
 o actionPerformed
  public void actionPerformed(JCActionEvent ev)
If an arrow button was pressed, calls setTextAction.
If the user changed the text field's value, calls validate.

See Also:
setTextAction, validate
 o keyPressed
  public void keyPressed(KeyEvent ev)
 o keyReleased
  public void keyReleased(KeyEvent ev)
 o keyTyped
  public void keyTyped(KeyEvent ev)
 o setLayout
  public final void setLayout(LayoutManager mgr)
Sets the layout manager for this container. This method is overridden to prevent the layout mgr from being set.

Overrides:
setLayout in class Container

All Packages  Class Hierarchy  This Package  Previous  Next  Index