|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.text.JTextComponent | +--javax.swing.JTextField | +--com.linxpda.dbaware.swing.DBNumericField
A data-aware component that only allows input of number values. A subclass of javax.swing.JTextField that only allows input of digits and decimal placeholders. A JNumericField can be specified to allow only integers (no decimals), currency (two decimal places only) or a preset number of decimals.
JNumericField uses special document classes, not event handlers, to control it's input so even text that is pasted into it is subject to the input constraints defined.
Inner classes inherited from class javax.swing.JTextField |
javax.swing.JTextField.AccessibleJTextField |
Inner classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
static int |
CURRENCY
Variable denoting the acceptance of up to two decimal places only. |
static int |
DECIMAL
Variable denoting the allowance of decimal values. |
static int |
INTEGER
Variable denoting to allow integer input only. |
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, NORTH, NORTH_EAST, NORTH_WEST, 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 | |
DBNumericField()
Creates an initially empty JNumericField. |
|
DBNumericField(int cols)
Creates an initially empty JNumericField that is 'cols' columns wide. |
|
DBNumericField(int cols,
int type)
Creates an empty JNumeric that is 'cols' columns wide and allows 'type' input. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
|
protected javax.swing.text.Document |
createDefaultModel()
|
java.lang.String |
getColumnLabel()
Returns the data column label associated with this component. |
float |
getFloat()
Returns the current value of the JNumericField as a float. |
int |
getInteger()
Returns the current value of the JNumericField as an int. |
java.lang.Object |
getValue()
Returns a dbaware component's value as an Object formatted in a manner in which the component can display. |
void |
reset()
Resets the component upon a request to clear screen from a DBRootPane . |
void |
setColumnLabel(java.lang.String column)
Sets the data column into which this component's value will be stored. |
void |
setDecimalsAllowed(int d)
Sets the maximum number of decimals allowed. |
void |
setType(int type)
Sets the type of input allowed. |
void |
setValue(Entry value)
Passes an Entry object,
from which the dbaware component retrieves
it's value and displays it. |
void |
setValue(float f)
Sets the value to the given float. |
void |
setValue(int i)
Sets the value to the given int. |
void |
setValue(java.lang.String value)
Sets the value of the JNumericField, using a string as the initializer. |
Methods inherited from class javax.swing.JTextField |
addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, fireActionPerformed, getAccessibleContext, getAction, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setFont, setHorizontalAlignment, setScrollOffset |
Methods inherited from class javax.swing.text.JTextComponent |
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretPosition, getDisabledTextColor, getDocument, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getUI, isEditable, isFocusTraversable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setDisabledTextColor, setDocument, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, 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, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int INTEGER
public static final int DECIMAL
public static final int CURRENCY
Constructor Detail |
public DBNumericField()
DECIMAL
.public DBNumericField(int cols)
DECIMAL
.cols
- The number of columns wide to make the JNumericFieldpublic DBNumericField(int cols, int type)
cols
- The number of columns wide to make the component.type
- Input type to allow. Should correlate to the static variables
INTEGER
, DECIMAL
or CURRENCY
.Method Detail |
public void setType(int type)
type
- The type of input to allow. Should equal the
static variabled INTEGER
, DECIMAL
or CURRENCY
.public void setDecimalsAllowed(int d)
DECIMAL
has been set. If this method is not called
then an infinite number of decimal places will be allowed.d
- The maximum number of decimal places to allow.public float getFloat()
public int getInteger()
public void setValue(java.lang.String value)
value
- A String that represents the value to display.public void setValue(float f)
INTEGER
and decimals are truncated.f
- The value to set.public void setValue(int i)
INTEGER
no decimals are added automatically.i
- The int value to set.public java.lang.String getColumnLabel()
DBAware
getColumnLabel
in interface DBAware
public void setColumnLabel(java.lang.String column)
DBAware
setColumnLabel
in interface DBAware
com.linxpda.dbaware.DBAware
label
- The name of the column in which to
store this component's value.public java.lang.Object getValue()
DBAware
getValue
in interface DBAware
public void setValue(Entry value)
DBAware
Entry
object,
from which the dbaware component retrieves
it's value and displays it.setValue
in interface DBAware
public void reset()
DBAware
DBRootPane
.reset
in interface DBAware
protected javax.swing.text.Document createDefaultModel()
createDefaultModel
in class javax.swing.JTextField
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |