public abstract class AbstractNumberFormField extends AbstractFormField
JTextField.AccessibleJTextFieldJTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBindingJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected DecimalFormat |
decimalFormat
the decimal decimalFormat
|
errorMessage, errorOffset, savedValuenotifyActionDEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEYlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTADJUST_LEFT, ADJUST_NONE, ADJUST_RIGHT, ADJUST_TRIM, CONVERT_LC, CONVERT_NONE, CONVERT_UCBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
AbstractNumberFormField()
Creates an empty AbstractNumberFormField with the default document model,
and minimum column width.
|
AbstractNumberFormField(Document doc,
int columns)
Creates a AbstractNumberFormField.
Notice: setting doc != null requires a doc derived from FormFieldDocument. |
AbstractNumberFormField(int columns)
Creates a AbstractNumberFormField with the default document model and
given column width.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearText()
Clears the contents of this component.
|
String |
doFormat(Object object)
Does the formatting of the given object.
Renders the object and returns the string. |
DecimalFormat |
getDecimalFormat()
Gets the current decimal format.
May be used to modify the format for special purposes. |
String |
getFormat()
Gets the format string.
|
boolean |
isBlankZero()
Returns the blankZero attribute.
|
boolean |
isUnsigned()
Returns whether decimalFormat is unsigned
|
protected void |
restoreSavedValue()
Restores the previously saved value.
Method is provided to be overridden by AbstractNumberFormField. |
void |
setBlankZero(boolean blankZero)
Sets whether zero fields are displayed as empty fields.
|
void |
setDecimalFormat(DecimalFormat decimalFormat)
Sets the decimal format.
|
void |
setFormat(String pattern)
Sets the format string.
The format string is used to format the view of the data. |
void |
setFormValue(Object object)
Sets a value in this component.
The method is used to update the view if the data has changed. |
void |
setText(String text)
Applications such as a GUI-Builder should not invoke setText for numeric fields directly.
|
void |
setUnsigned(boolean unsigned)
Sets field to unsigned.
|
void |
setValidChars(String validChars)
Sets allowed characters.
|
addValueListener, clearValueShownModified, createDefaultModel, downRight, fireValueChanged, fireValueEntered, getAdjust, getBinding, getBindingPath, getComponentPath, getConvert, getConverter, getDefaultColumns, getErrorMessage, getErrorOffset, getFiller, getFocusTraversalGroup, getHelpURL, getInvalidChars, getMaxColumns, getParentWindow, getPreferredSize, getPropertyGroup, getText, getToolTipText, getValidChars, getValueShown, getVerticalAlignment, hideErrorPopup, invalidateParentInfo, isAutoNext, isAutoSelect, isAutoUpdate, isBindable, isCaretLeft, isCaretRight, isCellEditorUsage, isChangeable, isEmpty, isEraseFirst, isFireRunning, isFormTraversable, isHonourChangeable, isInhibitAutoSelect, isMandatory, isOverwrite, isSmartValueEntered, isStartEditLeftmost, isTriggerValueChangedEnabled, isValueChanged, isValueShownModified, prepareFocusLost, processFocusEvent, processKeyBinding, removeValueListener, requestFocusLater, saveValue, setAdjust, setAutoNext, setAutoSelect, setAutoUpdate, setBindable, setBinding, setBindingPath, setCaretLeft, setCaretRight, setCellEditorUsage, setChangeable, setColumns, setComponentPath, setConvert, setConverter, setDefaultColumns, setEditable, setEraseFirst, setErrorMessage, setErrorOffset, setFiller, setFireRunning, setFocusTraversalGroup, setFormTraversable, setFormWrapWindow, setHelpURL, setHonourChangeable, setInhibitAutoSelect, setInvalidChars, setMandatory, setMaxColumns, setOverwrite, setPropertyGroup, setSmartValueEntered, setStartEditLeftmost, setTriggerValueChangedEnabled, setVerticalAlignment, showErrorPopup, showErrorPopup, showHelp, transferFocus, transferFocusBackward, triggerValueChanged, updateAllChangeable, upLeft, wasFocusGainedFromTransfer, wasFocusGainedFromTransferBackward, wasTransferFocus, wasTransferFocusBackward, wasTransferFocusByEnteractionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setDocument, setFont, setHorizontalAlignment, setScrollOffsetaddCaretListener, 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, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, writeaddAncestorListener, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, 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, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, 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, 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, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCaretPosition, getColumns, getHorizontalAlignment, postActionEvent, setCaretPosition, setHorizontalAlignment, setToolTipTextgetBaseline, getFormValue, hasFocusprotected DecimalFormat decimalFormat
public AbstractNumberFormField(Document doc, int columns)
doc - the document model, null = defaultcolumns - the number of columns, 0 = minimum widthpublic AbstractNumberFormField(int columns)
columns - the number of columns, 0 = minimum widthpublic AbstractNumberFormField()
public void setFormat(String pattern)
The format string will be converted to a DecimalFormat.
pattern - the format stringsetDecimalFormat(java.text.DecimalFormat)public String getFormat()
FormFieldComponentpublic void setDecimalFormat(DecimalFormat decimalFormat)
Useful if format cannot be fully described by setFormat(java.lang.String).
decimalFormat - the formatpublic DecimalFormat getDecimalFormat()
public void setFormValue(Object object)
FormComponentobject - is the object to setpublic void setText(String text)
setText in interface FormFieldComponentsetText in class AbstractFormFieldtext - ignored textprotected void restoreSavedValue()
AbstractNumberFormField.
Overridden because setText(java.lang.String) is overridden to swallow the text.
restoreSavedValue in class AbstractFormFieldpublic void clearText()
FormFieldComponentclearText in interface FormFieldComponentclearText in class AbstractFormFieldpublic String doFormat(Object object)
FormFieldComponentobject - the objectpublic void setUnsigned(boolean unsigned)
unsigned - true if unsigned, false if signedpublic boolean isUnsigned()
public void setValidChars(String validChars)
FormFieldComponentsetValidChars in interface FormFieldComponentsetValidChars in class AbstractFormFieldvalidChars - the valid characters, null = all (default)public void setBlankZero(boolean blankZero)
blankZero - true if zero values are displayed as empty field, default is falsepublic boolean isBlankZero()
Tentackle - distributed, domain- and model-driven