DESY ACOP Beans Home

com.cosylab.gui.components
Class NumberField

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextField
                      extended by com.cosylab.gui.components.ResizableTextField
                          extended by com.cosylab.gui.components.NumberField
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants

public class NumberField
extends ResizableTextField

Descendant of ResizableTextField which only allows input of numbers. Double and long number formats are supported through number document classes DobuleDocument and LongDocument, both descedents of AbstractNumberDocument, while display format is controlled using com.cosylab.util.PrintfFormat string parser. The number field operates in two modes. When in focus mode, the user can type in numbers that are recognized by the set number document of the number field. When the user presses the Enter key or the component goes out of focus the typed value is checked for range using the set minimum and maximum allowed values. Than the new value is displayed using the com.cosylab.util.PrinfFormat with the set format string. Value stored by the number field can be accessed through getter and setter methods in both double or long or even generic Number type.

Version:
$id$
Author:
Jernej Kamenik
See Also:
ResizableTextField, AbstractNumberDocument, PrintfFormat, Serialized Form

Nested Class Summary
protected  class NumberField.NumberActionAdapter
          Listens for action events and handles the focus change.
protected  class NumberField.NumberDocumentAdapter
          Listens for document events and handles the value property change.
protected  class NumberField.NumberFocusAdapter
          Listens for focus events sets the appropriate display mode.
protected  class NumberField.NumberKeyAdapter
          An implementation of KeyAdapter responsible for losing focus when the ESC key is pressed.
protected  class NumberField.TiltHandler
          An extension of Timer used for periodic tilting of the Wheelswitch.
 
Nested classes/interfaces inherited from class com.cosylab.gui.components.ResizableTextField
ResizableTextField.ResizableComponentAdapter, ResizableTextField.ResizableKeyAdapter
 
Nested classes/interfaces inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int ENTER_AT_CLICKED
          Enter policy - enter at clicked position.
static int ENTER_AT_END
          Enter policy - enter at the end of existing value.
static int ENTER_AT_START
          Enter policy - enter at the beginning of existing value.
static java.lang.String ENTER_POLICY
          Enter policy name tag.
static int ENTER_SELECTED
          Enter policy -
static java.lang.String NUMBER_TYPE
          Number type property name tag.
static int SET_AS_TYPED
          Setting policy - value set as typed.
static int SET_ON_APPLY
          Setting policy - value set on apply.
static int SET_ON_EXIT
          Setting policy - value set when focus is lost.
static java.lang.String SETTING_POLICY
          Setting policy name tag.
static java.lang.String VALUE
          Value property name tag.
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
NumberField()
          Default constructor for NumberField creates number field with zero value.
NumberField(java.lang.Number newValue)
          Constructs a new NumberField with value.
NumberField(java.lang.Number newValue, java.lang.String newFormat)
          Constructs a new NumberField with specified value and PrintfFormat format string.
 
Method Summary
 void addSetListener(SetListener l)
          Adds a SetListener to the list of listeners receiving events when sets are performed on this Numberfield.
 java.lang.Number castNumber(java.lang.Number number)
          Converts provided number to Number instance whose class matches current number type.
static java.lang.String createDefaultFormat(java.lang.Class<? extends java.lang.Number> numberType)
          Returns safe default format for type.
static java.lang.String createDefaultFormat(java.lang.Class<? extends java.lang.Number> numberType, java.lang.String format)
          Converts format string to default safe format for appropriate number type.
protected  void fireSetPerformed()
           
 double getDoubleValue()
          Returns the value of type doubleValue
 javax.swing.border.Border getEditBorder()
          Returns the edit border.
 int getEnterPolicy()
          Returns the current enter policy.
 java.lang.String getFormat()
          Returns the diplay format
 long getLongValue()
          Returns the value of type longValue
 java.lang.Number getMaximum()
          Returns the maximum value allowed by this NumberField.
 java.lang.Number getMinimum()
          Returns the minimum value allowed by this NumberField.
 java.awt.Color getNormalColor()
           
 NumberDescriptor getNumberDescriptor()
          Returns descriptor object, to which visualization of number as strring is dlegated.
 java.lang.Class<? extends java.lang.Number> getNumberType()
          Returns the number format
 java.awt.Color getOutOfBoundsColor()
           
 int getSettingPolicy()
          Returns the currently used seting policy by this Numberfield
 javax.swing.border.Border getStaticBorder()
          Returns the static border.
 java.lang.Number getValue()
          Returns generic representation of the value using the Number class.
 java.awt.Color getWarningColor()
           
 boolean isTiltingEnabled()
          Returns whether the component should indicate value out of bounds condition by visually tilting its border.
 boolean isWarnOutOfBounds()
          Returns the warnOutOfBounds.
static void main(java.lang.String[] args)
          For testing and demonstration purposes.
protected  void paintComponent(java.awt.Graphics g)
          This method hes been overriden to implement the feature of enhanced anti-aliasing paint of the text field.
 void removeSetListener(SetListener l)
          Removes a SetListener from the list of listeners receiving events when sets are performed on this Numberfield.
 void setDoubleValue(double newValue)
          Sets the value of type doubleValue to be displayed.
 void setEditBorder(javax.swing.border.Border border)
          Sets the edit border.
 void setEnterPolicy(int policy)
          Sets the enter policy.
 void setFormat(java.lang.String newFormat)
          Sets the display format.
 void setLongValue(long newValue)
          Sets the value of type long to be displayed.
 void setMaximum(java.lang.Number newMaximum)
          Sets the maximum allowed value that can be entered in this NumberField.
 void setMinimum(java.lang.Number newMinimum)
          Sets the minimum allowed value that can be entered in this NumberField.
 void setNormalColor(java.awt.Color normalColor)
           
 void setNumberDescriptor(NumberDescriptor numberDescriptor)
          When this is set with non-null value, this NumberField uses this descriptor to convert Number to string and back.
 void setNumberType(java.lang.Class<? extends java.lang.Number> newNumberFormat)
          Sets the number format.
 void setOutOfBoundsColor(java.awt.Color outOfBoundsColor)
           
 void setSettingPolicy(int newPolicy)
          Sets the setting policy of thi Numberdisplayer.
 void setStaticBorder(javax.swing.border.Border border)
          Sets the static border.
 void setTiltingEnabled(boolean b)
          Sets the tilitng enabled property.
 void setValue(java.lang.Number newValue)
          Sets the numeric value for this component.
 void setWarningColor(java.awt.Color warningColor)
           
 void setWarnOutOfBounds(boolean b)
          Sets the value of warnOutOfBounds flag.
 
Methods inherited from class com.cosylab.gui.components.ResizableTextField
getMinimumSize, getPreferredSize, isEnhanced, isResizable, resize, setEnhanced, setFont, setMargin, setMinimumSize, setPreferredSize, setResizable, setText
 
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SETTING_POLICY

public static final java.lang.String SETTING_POLICY
Setting policy name tag.

See Also:
Constant Field Values

SET_AS_TYPED

public static final int SET_AS_TYPED
Setting policy - value set as typed.

See Also:
Constant Field Values

SET_ON_APPLY

public static final int SET_ON_APPLY
Setting policy - value set on apply.

See Also:
Constant Field Values

SET_ON_EXIT

public static final int SET_ON_EXIT
Setting policy - value set when focus is lost.

See Also:
Constant Field Values

ENTER_POLICY

public static final java.lang.String ENTER_POLICY
Enter policy name tag.

See Also:
Constant Field Values

ENTER_AT_CLICKED

public static final int ENTER_AT_CLICKED
Enter policy - enter at clicked position.

See Also:
Constant Field Values

ENTER_SELECTED

public static final int ENTER_SELECTED
Enter policy -

See Also:
Constant Field Values

ENTER_AT_END

public static final int ENTER_AT_END
Enter policy - enter at the end of existing value.

See Also:
Constant Field Values

ENTER_AT_START

public static final int ENTER_AT_START
Enter policy - enter at the beginning of existing value.

See Also:
Constant Field Values

VALUE

public static final java.lang.String VALUE
Value property name tag.

See Also:
Constant Field Values

NUMBER_TYPE

public static final java.lang.String NUMBER_TYPE
Number type property name tag.

See Also:
Constant Field Values
Constructor Detail

NumberField

public NumberField(java.lang.Number newValue,
                   java.lang.String newFormat)
Constructs a new NumberField with specified value and PrintfFormat format string.

Parameters:
newValue - initial value (null not permitted)
newFormat - initial format (null not permitted)
Throws:
java.lang.IllegalArgumentException - if value or format is null

NumberField

public NumberField(java.lang.Number newValue)
Constructs a new NumberField with value.

Parameters:
newValue - initial value

NumberField

public NumberField()
Default constructor for NumberField creates number field with zero value.

Method Detail

createDefaultFormat

public static java.lang.String createDefaultFormat(java.lang.Class<? extends java.lang.Number> numberType,
                                                   java.lang.String format)
Converts format string to default safe format for appropriate number type.

Parameters:
numberType - number type for which format is created
format - old format to be used as reference
Returns:
safe default format
Throws:
java.lang.NullPointerException - if type is null

createDefaultFormat

public static java.lang.String createDefaultFormat(java.lang.Class<? extends java.lang.Number> numberType)
Returns safe default format for type.

Parameters:
numberType - number type
Returns:
default format
Throws:
java.lang.NullPointerException - if type is null

setDoubleValue

public void setDoubleValue(double newValue)
Sets the value of type doubleValue to be displayed.

Parameters:
newValue -

getDoubleValue

public double getDoubleValue()
Returns the value of type doubleValue

Returns:
doubleValue

setEditBorder

public void setEditBorder(javax.swing.border.Border border)
Sets the edit border. Edit border is visible around the input field when editing value.

Parameters:
border - new edit border

getEditBorder

public javax.swing.border.Border getEditBorder()
Returns the edit border.

Returns:
edit border

setEnterPolicy

public void setEnterPolicy(int policy)
Sets the enter policy. Enter policy specifies where the numbers will be entered once the user clicks on the displayer. Available policies:

Parameters:
policy - new policy

getEnterPolicy

public int getEnterPolicy()
Returns the current enter policy.

Returns:
enter policy

setFormat

public void setFormat(java.lang.String newFormat)
Sets the display format. Acceptsint standard format control strings.

Parameters:
newFormat - java.lang.String
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!
See Also:
PrintfFormat

getFormat

public java.lang.String getFormat()
Returns the diplay format

Returns:
java.lang.String

setLongValue

public void setLongValue(long newValue)
Sets the value of type long to be displayed.

Parameters:
newValue -

getLongValue

public long getLongValue()
Returns the value of type longValue

Returns:
longValue

setMaximum

public void setMaximum(java.lang.Number newMaximum)
Sets the maximum allowed value that can be entered in this NumberField. Setting maximum to null means no maximum is set. This method does not check for validity of the limit. If maximum is set less than minimum then no value can be set.

Parameters:
newMaximum - Number

getMaximum

public java.lang.Number getMaximum()
Returns the maximum value allowed by this NumberField. Can be null if no maximum is set.

Returns:
Number maximum allowed value.

setMinimum

public void setMinimum(java.lang.Number newMinimum)
Sets the minimum allowed value that can be entered in this NumberField. Setting minimum to null means no minimum is set. This method does not check for validity of the limit. If maximum is set less than minimum then no value can be set.

Parameters:
newMinimum - Number

getMinimum

public java.lang.Number getMinimum()
Returns the minimum value allowed by this NumberField. Can be null if no miminim is set.

Returns:
Number minimum allowed value

setNumberType

public void setNumberType(java.lang.Class<? extends java.lang.Number> newNumberFormat)
                   throws java.lang.IllegalArgumentException
Sets the number format. If possible, number format is converted to one of two supported document types: Long.class of Double.class.

Parameters:
newNumberFormat -
Throws:
java.lang.IllegalArgumentException

getNumberType

public java.lang.Class<? extends java.lang.Number> getNumberType()
Returns the number format

Returns:
java.lang.Class

setSettingPolicy

public void setSettingPolicy(int newPolicy)
Sets the setting policy of thi Numberdisplayer. SET_AS_TYPED updates the Numberfield value when typed. SET_ON_APPLY updates the Numberfield only on actionPerformed events (when the user presses ENTER) SET_ON_EXIT updates the numberfield when it loses focus

Parameters:
newPolicy -
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

getSettingPolicy

public int getSettingPolicy()
Returns the currently used seting policy by this Numberfield

Returns:
int currently used setting policy.

setStaticBorder

public void setStaticBorder(javax.swing.border.Border border)
Sets the static border. Static border is displayed around the input field when the displayer does not have focus.

Parameters:
border - new static border

getStaticBorder

public javax.swing.border.Border getStaticBorder()
Returns the static border.

Returns:
the static border

setTiltingEnabled

public void setTiltingEnabled(boolean b)
Sets the tilitng enabled property.

Parameters:
b - whether the component should tilt when value is out of bounds.

isTiltingEnabled

public boolean isTiltingEnabled()
Returns whether the component should indicate value out of bounds condition by visually tilting its border.

Returns:
boolean

setWarnOutOfBounds

public void setWarnOutOfBounds(boolean b)
Sets the value of warnOutOfBounds flag. If true this NumberField signals by change of color that displayed value is out of bounds.

Parameters:
b - whether this component should change background color if value is out of bounds.

setValue

public void setValue(java.lang.Number newValue)
Sets the numeric value for this component. New value is subject to min/max test if any of them is set. If new value does not fall within these bounds, setValue will do nothing.

Parameters:
newValue - Number

getValue

public java.lang.Number getValue()
Returns generic representation of the value using the Number class.

Returns:
java.lang.Number

addSetListener

public void addSetListener(SetListener l)
Adds a SetListener to the list of listeners receiving events when sets are performed on this Numberfield.

Parameters:
l - listener to be added.

removeSetListener

public void removeSetListener(SetListener l)
Removes a SetListener from the list of listeners receiving events when sets are performed on this Numberfield.

Parameters:
l - listener to be removed.

fireSetPerformed

protected void fireSetPerformed()

paintComponent

protected void paintComponent(java.awt.Graphics g)
Description copied from class: ResizableTextField
This method hes been overriden to implement the feature of enhanced anti-aliasing paint of the text field.

Overrides:
paintComponent in class ResizableTextField
Parameters:
g - Graphics
See Also:
JComponent.paintComponent(Graphics)

getNumberDescriptor

public NumberDescriptor getNumberDescriptor()
Returns descriptor object, to which visualization of number as strring is dlegated.

Returns:
number visualization

setNumberDescriptor

public void setNumberDescriptor(NumberDescriptor numberDescriptor)
When this is set with non-null value, this NumberField uses this descriptor to convert Number to string and back. By this user can define ovn visualization of Number.

Parameters:
numberDescriptor - new Number visualization, can be null

castNumber

public java.lang.Number castNumber(java.lang.Number number)
Converts provided number to Number instance whose class matches current number type.

Parameters:
number - number to be cast to current number type
Returns:
correct number type

getNormalColor

public java.awt.Color getNormalColor()
Returns:
Returns the normalColor.

setNormalColor

public void setNormalColor(java.awt.Color normalColor)
Parameters:
normalColor - The normalColor to set.

getOutOfBoundsColor

public java.awt.Color getOutOfBoundsColor()
Returns:
Returns the outOfBoundsColor.

setOutOfBoundsColor

public void setOutOfBoundsColor(java.awt.Color outOfBoundsColor)
Parameters:
outOfBoundsColor - The outOfBoundsColor to set.

getWarningColor

public java.awt.Color getWarningColor()
Returns:
Returns the warningColor.

setWarningColor

public void setWarningColor(java.awt.Color warningColor)
Parameters:
warningColor - The warningColor to set.

isWarnOutOfBounds

public boolean isWarnOutOfBounds()
Returns the warnOutOfBounds.

Returns:
Returns the warnOutOfBounds.

main

public static void main(java.lang.String[] args)
For testing and demonstration purposes.

Parameters:
args - String[]


Copyright © 2010. All Rights Reserved.