JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.field
Class JCTextField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.text.JTextComponent
                          |
                          +--javax.swing.JTextField
                                |
                                +--com.klg.jclass.field.JCTextField
All Implemented Interfaces:
Accessible, ImageObserver, JCFieldComponent, MenuContainer, Scrollable, Serializable, SwingConstants
Direct Known Subclasses:
DSdbTextField, JBdbTextField, JCTextFieldCellEditor, JCTextFieldCellRenderer

public class JCTextField
extends JTextField
implements JCFieldComponent

JCTextField has all the capability of JTextField, as well as the ability to validate its contents.

See Also:
JTextField, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JTextField
JTextField.AccessibleJTextField
 
Nested classes inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  com.klg.jclass.field.Field field
           
protected  boolean required
           
static String version
          Contains the version number of the JClass product.
 
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 com.klg.jclass.field.JCFieldComponent
INVALID, UNDEREDIT, VALID
 
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
JCTextField()
          Constructs an empty JCTextField.
JCTextField(Class c)
          Constructs an empty JCTextField, which expects an object of the specified class.
JCTextField(Class c, com.klg.jclass.field.validate.JCValidator v)
          Constructs an empty JCTextField, which expects an object of the specified class and uses the specified validator.
JCTextField(int columns)
          Constructs a JCTextField with the specified number of columns.
JCTextField(com.klg.jclass.util.value.JCValueModel m)
          Constructs an empty JCTextField, which uses the specified value model to contain its value.
JCTextField(com.klg.jclass.util.value.JCValueModel m, com.klg.jclass.field.validate.JCValidator v)
          Constructs an empty JCTextField, which uses the specified value model to contain its value and uses the specified validator.
JCTextField(String text)
          Constructs a JCTextField initialized with the specified text.
JCTextField(String text, int columns)
          Constructs an empty JCTextField with the specified number of columns and initialized with the specified text.
 
Method Summary
 void addNotify()
          Initializes the field object.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addValueListener(com.klg.jclass.util.value.JCValueListener listener)
          Adds a listener to listen for changes to the value.
 void commitEdit()
          Commits the current field under edit.
protected  void createField(com.klg.jclass.field.validate.JCValidator validator)
          Creates the field object which controls the validation.
 String getAbout()
          Gets the value of the About property.
 com.klg.jclass.field.DataProperties getDataProperties()
          Gets the Bean property which wraps the validator, data model, and Field objects properties into one property.
 com.klg.jclass.field.JCInvalidInfo getInvalidInfo()
          Returns the Invalid properties.
 boolean getSelectOnEnter()
          Returns a flag indicating the selection status on entering the field.
 int getState()
          Returns the state of the component.
 com.klg.jclass.field.validate.JCValidator getValidator()
          Returns the validator currently in use.
 Object getValue()
          Returns the value for the text field.
 com.klg.jclass.util.value.JCValueModel getValueModel()
          Returns the data model being used by the field.
 boolean isRequired()
          Returns true if the field is required.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
          Removes a listener which listens for changes to the value.
 void setAbout(String s)
          Sets the value of the About property.
 void setBackground(Color background)
          Sets the background color of the text field.
 void setDataProperties(com.klg.jclass.field.DataProperties dp)
          Sets the Bean property which wraps the validator, data model, and Field objects properties into one property.
 void setEditable(boolean b)
          Overrides setEditable to make sure the background is set to the correct color immediately (otherwise the setBackground() method above will intercept the change and nothing will happen until the user tries to edit the field).
 void setForeground(Color foreground)
          Sets the foreground color of the text field.
 void setInvalidInfo(com.klg.jclass.field.JCInvalidInfo info)
          Sets the Invalid properties.
 void setLocale(Locale l)
          Sets the locale being used by the text field; sets it on the validator as well.
 void setRequired(boolean required)
          Sets the required property for the current field.
 void setSelectOnEnter(boolean select)
          Sets a flag that determines whether or not the value in the field is selected when the component gains focus.
 void setValidator(com.klg.jclass.field.validate.JCValidator validator)
          Sets the validator to use.
 void setValue(Object value)
          Sets the value for the text field.
 void setValueModel(com.klg.jclass.util.value.JCValueModel model)
          Sets the data model being used by the field.
 
Methods inherited from class javax.swing.JTextField
addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, 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

field

protected com.klg.jclass.field.Field field

required

protected boolean required

version

public static final String version
Contains the version number of the JClass product.

Constructor Detail

JCTextField

public JCTextField()
Constructs an empty JCTextField.


JCTextField

public JCTextField(Class c)
Constructs an empty JCTextField, which expects an object of the specified class.

Parameters:
c - the class type the field will expect

JCTextField

public JCTextField(Class c,
                   com.klg.jclass.field.validate.JCValidator v)
Constructs an empty JCTextField, which expects an object of the specified class and uses the specified validator.

Parameters:
c - the class type the field will expect
v - the validator that validates input in the field

JCTextField

public JCTextField(com.klg.jclass.util.value.JCValueModel m)
Constructs an empty JCTextField, which uses the specified value model to contain its value.

Parameters:
m - the value model that contains the value

JCTextField

public JCTextField(com.klg.jclass.util.value.JCValueModel m,
                   com.klg.jclass.field.validate.JCValidator v)
Constructs an empty JCTextField, which uses the specified value model to contain its value and uses the specified validator.

Parameters:
m - the value model that contains the value
v - the validator that validates input in the field

JCTextField

public JCTextField(String text)
Constructs a JCTextField initialized with the specified text.

Parameters:
text - the text with which to initialize the field

JCTextField

public JCTextField(int columns)
Constructs a JCTextField with the specified number of columns.

Parameters:
columns - the number of columns

JCTextField

public JCTextField(String text,
                   int columns)
Constructs an empty JCTextField with the specified number of columns and initialized with the specified text.

Parameters:
text - the text with which to initialize the field
columns - the number of columns
Method Detail

getDataProperties

public com.klg.jclass.field.DataProperties getDataProperties()
Gets the Bean property which wraps the validator, data model, and Field objects properties into one property.

Specified by:
getDataProperties in interface JCFieldComponent
Returns:
the DataProperties Bean wrapper
See Also:
JCValidator, JCValueModel, JCInvalidInfo

setDataProperties

public void setDataProperties(com.klg.jclass.field.DataProperties dp)
Sets the Bean property which wraps the validator, data model, and Field objects properties into one property.

Specified by:
setDataProperties in interface JCFieldComponent
Parameters:
dp - the new DataProperties value
See Also:
JCValidator, JCValueModel, JCInvalidInfo

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.

Overrides:
addPropertyChangeListener in class JComponent
Parameters:
listener - the PropertyChangeListener to be added

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Overrides:
removePropertyChangeListener in class JComponent
Parameters:
listener - the PropertyChangeListener to be removed

addValueListener

public void addValueListener(com.klg.jclass.util.value.JCValueListener listener)
Adds a listener to listen for changes to the value.

Specified by:
addValueListener in interface JCFieldComponent
Parameters:
listener - the JCValueListener to be added

removeValueListener

public void removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
Removes a listener which listens for changes to the value.

Specified by:
removeValueListener in interface JCFieldComponent
Parameters:
listener - the JCValueListener to be removed

addNotify

public void addNotify()
Initializes the field object. This method should not need to be called.

Overrides:
addNotify in class JComponent

createField

protected void createField(com.klg.jclass.field.validate.JCValidator validator)
Creates the field object which controls the validation.

Parameters:
validator - the object which does the validation

getAbout

public String getAbout()
Gets the value of the About property. The About property displays contact information for Quest Software in the Bean box.

Returns:
the about String

setAbout

public void setAbout(String s)
Sets the value of the About property. The About property displays contact information for Quest Software in the bean box.

Parameters:
s - the new about String (ignored)

setBackground

public void setBackground(Color background)
Sets the background color of the text field.

Overrides:
setBackground in class JComponent
Parameters:
background - the new background color

setForeground

public void setForeground(Color foreground)
Sets the foreground color of the text field.

Overrides:
setForeground in class JComponent
Parameters:
foreground - the new foreground color

getValue

public Object getValue()
Returns the value for the text field.

Specified by:
getValue in interface JCFieldComponent
Returns:
the current value of the field

setValue

public void setValue(Object value)
Sets the value for the text field.

Specified by:
setValue in interface JCFieldComponent
Parameters:
value - the new value of the field

getValueModel

public com.klg.jclass.util.value.JCValueModel getValueModel()
Returns the data model being used by the field.

Specified by:
getValueModel in interface JCFieldComponent
Returns:
the current value model for the field
See Also:
JCValueModel

setValueModel

public void setValueModel(com.klg.jclass.util.value.JCValueModel model)
Sets the data model being used by the field.

Specified by:
setValueModel in interface JCFieldComponent
Parameters:
model - the new value model for the field
See Also:
JCValueModel

getValidator

public com.klg.jclass.field.validate.JCValidator getValidator()
Returns the validator currently in use.

Specified by:
getValidator in interface JCFieldComponent
Returns:
the current validator for the field
See Also:
JCValidator

setValidator

public void setValidator(com.klg.jclass.field.validate.JCValidator validator)
Sets the validator to use.

Specified by:
setValidator in interface JCFieldComponent
Parameters:
validator - the new validator for the field
See Also:
JCValidator

getInvalidInfo

public com.klg.jclass.field.JCInvalidInfo getInvalidInfo()
Returns the Invalid properties. The Invalid properties are beepOnInvalid, invalidForeground, invalidBackground, defaultValue, and invalidPolicy.

Specified by:
getInvalidInfo in interface JCFieldComponent
Returns:
The current invalid information object

setInvalidInfo

public void setInvalidInfo(com.klg.jclass.field.JCInvalidInfo info)
Sets the Invalid properties. The Invalid properties are beepOnInvalid, invalidForeground, invalidBackground, defaultValue, and invalidPolicy.

Specified by:
setInvalidInfo in interface JCFieldComponent
Parameters:
info - the new Invalid information object

getState

public int getState()
Returns the state of the component.

Specified by:
getState in interface JCFieldComponent
Returns:
the current state; will be one of JCFieldComponent.VALID, JCFieldComponent.INVALID, or JCFieldComponent.UNDER_EDIT

getSelectOnEnter

public boolean getSelectOnEnter()
Returns a flag indicating the selection status on entering the field.

Specified by:
getSelectOnEnter in interface JCFieldComponent
Returns:
whether or not to set the selection on entering the field
See Also:
setSelectOnEnter(boolean)

setSelectOnEnter

public void setSelectOnEnter(boolean select)
Sets a flag that determines whether or not the value in the field is selected when the component gains focus. The default value is false.

Specified by:
setSelectOnEnter in interface JCFieldComponent
Parameters:
select - if true, set the selection on entering the field

commitEdit

public void commitEdit()
Commits the current field under edit.

Specified by:
commitEdit in interface JCFieldComponent

isRequired

public boolean isRequired()
Returns true if the field is required.

Specified by:
isRequired in interface JCFieldComponent
Returns:
whether this field is required

setRequired

public void setRequired(boolean required)
Sets the required property for the current field.

Specified by:
setRequired in interface JCFieldComponent
Parameters:
required - if true, this field is required

setEditable

public void setEditable(boolean b)
Overrides setEditable to make sure the background is set to the correct color immediately (otherwise the setBackground() method above will intercept the change and nothing will happen until the user tries to edit the field).

Overrides:
setEditable in class JTextComponent
Parameters:
b - if true, the field is editable

setLocale

public void setLocale(Locale l)
Sets the locale being used by the text field; sets it on the validator as well.

Overrides:
setLocale in class Component
Parameters:
l - the new locale to be used

Copyright © 2004 Quest Software Inc..
All rights reserved.