JClass 4.5.0 API
Documentation

com.klg.jclass.field
Class JCComboField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JComboBox
                          |
                          +--com.klg.jclass.field.JCComboField
Direct Known Subclasses:
DSdbComboField, JBdbComboField, JCComboFieldCellEditor, JCComboFieldCellEditorRenderer, JCComboFieldCellRenderer, JCPopupField, VCdbComboField

public class JCComboField
extends JComboBox
implements JCFieldComponent

JCComboField has all the capability of JComboBox as well as the ability to validate its contents.

See Also:
JComboBox, Serialized Form

Inner classes inherited from class javax.swing.JComboBox
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManager
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
protected  Field field
           
protected  boolean required
           
protected  JTextField text
           
static String version
          Contains the version number of the JClass product.
 
Fields inherited from class javax.swing.JComboBox
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
 
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
 
Constructor Summary
JCComboField()
          Constructs a JCComboField.
JCComboField(Class c)
          Constructs an empty JCComboField which expects an object of the specified class.
JCComboField(Class c, JCValidator v)
          Constructs an empty JCComboField which expects an object of the specified class and which uses the specified validator.
JCComboField(com.klg.jclass.util.value.JCValueModel m)
          Constructs an empty JCComboField which uses the specified value model to contain its value.
JCComboField(com.klg.jclass.util.value.JCValueModel m, JCValidator v)
          Constructs an empty JCComboField which uses the specified value model to contain its value and which uses the specified validator.
 
Method Summary
 void add(String item)
          Adds an item to the list.
 void addActionListener(ActionListener l)
          Adds an ActionListener.
 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 for changes to the value.
 void commitEdit()
          Commits the current field under edit.
protected  void createField(JCValidator validator)
           
 String getAbout()
          Gets the value of the About property.
 DataProperties getDataProperties()
          Gets the Bean property which wraps the validator, data model, and Field objects properties into one property.
 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: VALID, INVALID, or UNDER_EDIT.
protected  JTextField getTextFieldEditor()
          Convenience method to return the TextField Editor Component
 JCValidator getValidator()
          Returns the validator currently in use.
 Object getValue()
          Returns the value for the combo 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 removeActionListener(ActionListener l)
          Removes an ActionListener.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
          Removes a listener for changes to the value.
 void setAbout(String s)
          Sets the value of the About property.
 void setBackground(Color background)
          Sets the background of the combo field.
 void setDataProperties(DataProperties dp)
          Sets the Bean property which wraps the validator, data model, and Field objects properties into one property.
 void setForeground(Color foreground)
          Sets the foreground of the combo field.
 void setInvalidInfo(JCInvalidInfo info)
          Sets the Invalid properties.
 void setItems(String[] items)
          Sets the list of choices.
 void setRequired(boolean required)
          Sets the required property for the current field.
 void setSelectOnEnter(boolean select)
          Sets a flag to determine whether the value in the field is selected when the component gains focus.
 void setUI(ComboBoxUI ui)
          Sets the look and feel for this component.
 void setValidator(JCValidator v)
          Sets the validator to use.
 void setValue(Object value)
          Sets the value for the combo field.
 void setValueModel(com.klg.jclass.util.value.JCValueModel model)
          Sets the data model being used by the field.
 void updateUI()
          Updates the look and feel for this component.
 
Methods inherited from class javax.swing.JComboBox
actionPerformed, addItem, addItemListener, configureEditor, contentsChanged, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, getAccessibleContext, getActionCommand, getEditor, getItemAt, getItemCount, getKeySelectionManager, getMaximumRowCount, getModel, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isFocusTraversable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeAllItems, removeItem, removeItemAt, removeItemListener, selectedItemChanged, selectWithKeyChar, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setRenderer, setSelectedIndex, setSelectedItem, showPopup
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, 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, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, 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, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, 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

field

protected Field field

text

protected JTextField text

required

protected boolean required

version

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

JCComboField

public JCComboField()
Constructs a JCComboField.

JCComboField

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

JCComboField

public JCComboField(Class c,
                    JCValidator v)
Constructs an empty JCComboField which expects an object of the specified class and which uses the specified validator.

JCComboField

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

JCComboField

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

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

addValueListener

public void addValueListener(com.klg.jclass.util.value.JCValueListener listener)
Adds a listener for changes to the value.
Specified by:
addValueListener in interface JCFieldComponent

removeValueListener

public void removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
Removes a listener for changes to the value.
Specified by:
removeValueListener in interface JCFieldComponent

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

getDataProperties

public 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
Tags copied from interface: JCFieldComponent
See Also:
JCValidator, JCValueModel, JCInvalidInfo

setDataProperties

public void setDataProperties(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
Tags copied from interface: JCFieldComponent
See Also:
JCValidator, JCValueModel, JCInvalidInfo

createField

protected void createField(JCValidator validator)

getAbout

public String getAbout()
Gets the value of the About property. The About property displays contact information for KL Group in the bean box.

setAbout

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

addNotify

public void addNotify()
Initializes the field object. This method should not need to be called.
Overrides:
addNotify in class JComponent

setBackground

public void setBackground(Color background)
Sets the background of the combo field.
Overrides:
setBackground in class JComponent

setForeground

public void setForeground(Color foreground)
Sets the foreground of the combo field.
Overrides:
setForeground in class JComponent

getTextFieldEditor

protected JTextField getTextFieldEditor()
Convenience method to return the TextField Editor Component

getValue

public Object getValue()
Returns the value for the combo field
Specified by:
getValue in interface JCFieldComponent

setValue

public void setValue(Object value)
Sets the value for the combo field.
Specified by:
setValue in interface JCFieldComponent

getValueModel

public com.klg.jclass.util.value.JCValueModel getValueModel()
Returns the data model being used by the field.
Specified by:
getValueModel in interface JCFieldComponent
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
See Also:
JCValueModel

getValidator

public JCValidator getValidator()
Returns the validator currently in use.
Specified by:
getValidator in interface JCFieldComponent
Tags copied from interface: JCFieldComponent
See Also:
JCValidator

setValidator

public void setValidator(JCValidator v)
Sets the validator to use.
Specified by:
setValidator in interface JCFieldComponent
Tags copied from interface: JCFieldComponent
See Also:
JCValidator

getInvalidInfo

public JCInvalidInfo getInvalidInfo()
Returns the Invalid properties. The Invalid properties are beepOnInvalid, invalidForeground, invalidBackground, defaultValue, and invalidPolicy.
Specified by:
getInvalidInfo in interface JCFieldComponent

setInvalidInfo

public void setInvalidInfo(JCInvalidInfo info)
Sets the Invalid properties. The Invalid properties are beepOnInvalid, invalidForeground, invalidBackground, defaultValue, and invalidPolicy.
Specified by:
setInvalidInfo in interface JCFieldComponent

getState

public int getState()
Returns the state of the component: VALID, INVALID, or UNDER_EDIT.
Specified by:
getState in interface JCFieldComponent

getSelectOnEnter

public boolean getSelectOnEnter()
Returns a flag indicating the selection status on entering the field.
Specified by:
getSelectOnEnter in interface JCFieldComponent
See Also:
setSelectOnEnter(boolean)

setSelectOnEnter

public void setSelectOnEnter(boolean select)
Sets a flag to determine whether the value in the field is selected when the component gains focus. The default value is false.
Specified by:
setSelectOnEnter in interface JCFieldComponent

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

setRequired

public void setRequired(boolean required)
Sets the required property for the current field.
Specified by:
setRequired in interface JCFieldComponent

setUI

public void setUI(ComboBoxUI ui)
Sets the look and feel for this component. This method is used internally. You should not have to call it.
Overrides:
setUI in class JComboBox

updateUI

public void updateUI()
Updates the look and feel for this component. This method is used internally. You should not have to call it.
Overrides:
updateUI in class JComboBox

addActionListener

public void addActionListener(ActionListener l)
Adds an ActionListener. An action event is generated when the edited item changes.
Overrides:
addActionListener in class JComboBox

removeActionListener

public void removeActionListener(ActionListener l)
Removes an ActionListener.
Overrides:
removeActionListener in class JComboBox

setItems

public void setItems(String[] items)
Sets the list of choices. This method is for internal use only. To set the list, use the setPickList method in the AbstractValidator class.
See Also:
AbstractValidator.setPickList(javax.swing.ListModel)

add

public void add(String item)
Adds an item to the list. This method is for internal use only. To set the list, use the setPickList method in the AbstractValidator class.
See Also:
AbstractValidator.setPickList(javax.swing.ListModel)

Copyright© 1999-2000 KL Group Inc.
All rights reserved.