|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JComboBox
com.nqadmin.swingSet.SSComboBox
public class SSComboBox
SSComboBox.java
SwingSet - Open Toolkit For Making Swing Controls Database-Aware
Provides a way of displaying text corresponding to codes that are stored in
the database. By default the codes start from zero. If you want to provide a
different mapping for the items in the combobox then a string of integers
containing the corresponding numeric values for each choice must be provided.
Note that if you DO NOT want to use the default mappings, the custom
mappings must be set before calling the bind() method to bind the
combobox to a database column.
Also, if changing both a sSRowSet and column name consider using the bind()
method rather than individual setSSRowSet() and setColumName() calls.
e.g.
SSComboBox combo = new SSComboBox();
String[] options = {"111", "2222", "33333"};
combo.setOptions(options);
For the above items the combobox assumes that the values start from zero:
"111" -> 0, "2222" -> 1, "33333" -> 2
To give your own mappings you can set the mappings separately or pass
them along with the options:
SSComboBox combo = new SSComboBox();
String[] options = {"111", "2222", "33333"};
int[] mappings = { 1,5,7 };
combo.setOptions(options, mappings);
// next line is assuming mysSRowSet has been initialized and my_column is a
// column in mysSRowSet
combo.bind(mysSRowSet,"my_column");
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComboBox |
|---|
javax.swing.JComboBox.KeySelectionManager |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Field Summary | |
|---|---|
static int |
EXCLUDE
Predefined "exclude" option. |
static int |
FEMALE
Predefined "female" option. |
static int |
GENDER_OPTION
Constant indicating that combo box should display predefined gender options. |
static int |
INCLUDE
Predefined "include" option. |
static int |
INCLUDE_EXCLUDE_OPTION
Constant indicating that combo box should display predefined include/exclude options. |
static int |
MALE
Predefined "male" option. |
static int |
NO
Predefined "no" option. |
static int |
NON_SELECTED
Value to represent that no item has been selected in the combo box. |
static int |
SEX_OPTION
Deprecated. |
static int |
UNI_SEX
Deprecated. |
static int |
UNISEX
Predefined "unisex" option. |
static int |
YES
Predefined "yes" option. |
static int |
YES_NO_OPTION
Constant indicating that combo box should display predefined yes/no options. |
| Fields inherited from class javax.swing.JComponent |
|---|
TOOL_TIP_TEXT_KEY, 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 java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
SSComboBox()
Creates an object of SSComboBox. |
|
SSComboBox(SSTextDocument document)
Deprecated. |
|
| Method Summary | |
|---|---|
void |
bind(SSRowSet _sSRowSet,
java.lang.String _columnName)
Sets the SSRowSet and column name to which the component is to be bound. |
java.lang.String |
getColumnName()
Returns the column name to which the combo is bound. |
javax.swing.JComboBox |
getComboBox()
Deprecated. |
java.awt.Component |
getComponent()
Deprecated. |
int[] |
getMappings()
Returns the underlying values for each of the items in the combo box (e.g. |
java.lang.String[] |
getOptions()
Returns the items displayed in the combo box. |
int |
getPredefinedOptions()
Returns the option code used to display predefined options in the combo box. |
int |
getSelectedValue()
Returns the combo box value associated with the currently selected item. |
SSRowSet |
getSSRowSet()
Returns the SSRowSet being used to get the values. |
void |
setColumnName(java.lang.String _columnName)
Sets the SSRowSet column name to which the component is bound. |
void |
setDocument(SSTextDocument _document)
Deprecated. |
void |
setMappings(int[] _mappings)
Sets the underlying values for each of the items in the combo box (e.g. |
void |
setMappingValues(int[] _mappings)
Deprecated. |
boolean |
setOption(int _option)
Deprecated. |
void |
setOption(int _options,
int[] _mappings)
Deprecated. |
boolean |
setOption(java.lang.String[] _options)
Deprecated. |
boolean |
setOption(java.lang.String[] _options,
int[] _mappings)
Deprecated. |
void |
setOptions(java.lang.String[] _options)
Adds an array of strings as combo box items. |
boolean |
setOptions(java.lang.String[] _options,
int[] _mappings)
Sets the options to be displayed in the combo box and their corresponding values. |
boolean |
setPredefinedOptions(int _predefinedOptions)
Sets the options to be displayed in the combo box based on common predefined options. |
void |
setSelectedValue(int _value)
Sets the value stored in the component. |
void |
setSSRowSet(SSRowSet _sSRowSet)
Sets the SSRowSet to which the component is bound. |
| Methods inherited from class javax.swing.JComboBox |
|---|
actionPerformed, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, contentsChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, processKeyEvent, removeActionListener, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, setUI, showPopup, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int NON_SELECTED
public static final int YES_NO_OPTION
public static final int YES
public static final int NO
public static final int GENDER_OPTION
public static final int MALE
public static final int FEMALE
public static final int UNISEX
public static final int INCLUDE_EXCLUDE_OPTION
public static final int EXCLUDE
public static final int INCLUDE
public static final int SEX_OPTION
GENDER_OPTION,
Constant Field Valuespublic static final int UNI_SEX
UNISEX,
Constant Field Values| Constructor Detail |
|---|
public SSComboBox()
public SSComboBox(SSTextDocument document)
| Method Detail |
|---|
public void setSelectedValue(int _value)
_value - value to assign to combo boxpublic int getSelectedValue()
public void setColumnName(java.lang.String _columnName)
_columnName - column name in the SSRowSet to which the component
is boundpublic java.lang.String getColumnName()
public void setSSRowSet(SSRowSet _sSRowSet)
_sSRowSet - SSRowSet to which the component is boundpublic SSRowSet getSSRowSet()
public void setMappings(int[] _mappings)
_mappings - an array of values that correspond to those in the combo box.public int[] getMappings()
public void setOptions(java.lang.String[] _options)
_options - the list of options that you want to appear in the combo box.public java.lang.String[] getOptions()
public boolean setOptions(java.lang.String[] _options,
int[] _mappings)
_options - options to be displayed in the combo box._mappings - integer values that correspond to the options in the combo box.
public boolean setPredefinedOptions(int _predefinedOptions)
_predefinedOptions - predefined options to be displayed in the combo box.public int getPredefinedOptions()
public void bind(SSRowSet _sSRowSet,
java.lang.String _columnName)
_sSRowSet - datasource to be used._columnName - Name of the column to which this check box should be boundpublic void setDocument(SSTextDocument _document)
_document - text document to which the combo box has to be boundbind(com.nqadmin.swingSet.datasources.SSRowSet, java.lang.String)public javax.swing.JComboBox getComboBox()
public java.awt.Component getComponent()
public boolean setOption(java.lang.String[] _options)
_options - the list of options that you want to appear in the combo box.
setOptions(java.lang.String[])
public boolean setOption(java.lang.String[] _options,
int[] _mappings)
_options - options to be displayed in the combo box._mappings - integer values that correspond to the options in the combo box.
setOptions(java.lang.String[])
public void setOption(int _options,
int[] _mappings)
throws java.beans.PropertyVetoException
_options - predefined options to be displayed in the combo box._mappings - integer values that correspond to the options in the combo box.
java.beans.PropertyVetoExceptionsetPredefinedOptions(int),
setMappings(int[])public boolean setOption(int _option)
_option - predefined options to be displayed in the combo box.setPredefinedOptions(int)public void setMappingValues(int[] _mappings)
_mappings - an array of values that correspond to those in the combo box.setMappings(int[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||