org.compiere.swing
Class CComboBox
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JComboBox
|
+--org.compiere.swing.CComboBox
- All Implemented Interfaces:
- Accessible, ActionListener, CEditor, EventListener, ImageObserver, ItemSelectable, ListDataListener, MenuContainer, Serializable
- public class CComboBox
- extends JComboBox
- implements CEditor
Compiere Colored Combo Box.
- Version:
- $Id: CComboBox.java,v 1.14 2002/09/01 22:34:37 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
- Serialized Form
Constructor Summary |
CComboBox()
Creates a JComboBox with a default data model. |
CComboBox(ComboBoxModel aModel)
Creates a JComboBox that takes it's items from an
existing ComboBoxModel . |
CComboBox(Object[] items)
Creates a JComboBox that contains the elements
in the specified array. |
CComboBox(Vector items)
Creates a JComboBox that contains the elements
in the specified Vector. |
Methods inherited from class javax.swing.JComboBox |
actionPerformed, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeActionListener, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, showPopup, updateUI |
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, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, 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, addInputMethodListener, addKeyListener, 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, getInputMethodRequests, 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, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
CComboBox
public CComboBox(ComboBoxModel aModel)
- Creates a
JComboBox
that takes it's items from an
existing ComboBoxModel
. Since the
ComboBoxModel
is provided, a combo box created using
this constructor does not create a default combo box model and
may impact how the insert, remove and add methods behave.
- Parameters:
aModel
- the ComboBoxModel
that provides the
displayed list of items- See Also:
DefaultComboBoxModel
CComboBox
public CComboBox(Object[] items)
- Creates a
JComboBox
that contains the elements
in the specified array. By default the first item in the array
(and therefore the data model) becomes selected.
- Parameters:
items
- an array of objects to insert into the combo box- See Also:
DefaultComboBoxModel
CComboBox
public CComboBox(Vector items)
- Creates a
JComboBox
that contains the elements
in the specified Vector. By default the first item in the vector
and therefore the data model) becomes selected.
- Parameters:
items
- an array of vectors to insert into the combo box- See Also:
DefaultComboBoxModel
CComboBox
public CComboBox()
- Creates a
JComboBox
with a default data model.
The default data model is an empty list of objects.
Use addItem
to add items. By default the first item
in the data model becomes selected.
- See Also:
DefaultComboBoxModel
setIcon
public void setIcon(Icon defaultIcon)
- Set Icon of arrow button to icon
- Parameters:
defaultIcon
- Icon to be displayed
setUI
public void setUI(ComboBoxUI ui)
- Set UI and re-set Icon for arrow button
- Overrides:
setUI
in class JComboBox
- Parameters:
ui
-
displayPopup
public boolean displayPopup()
- Display Popup.
Called from CompiereComboPopup and allows to implement
alternative actions than showing the popup
- Returns:
- if true, the popup should be displayed
setMandatory
public void setMandatory(boolean mandatory)
- Set Editor Mandatory
- Specified by:
setMandatory
in interface CEditor
- Parameters:
mandatory
- true, if you have to enter data
isMandatory
public boolean isMandatory()
- Is Field mandatory
- Specified by:
isMandatory
in interface CEditor
- Returns:
- true, if mandatory
setReadWrite
public void setReadWrite(boolean rw)
- Enable Editor
- Specified by:
setReadWrite
in interface CEditor
- Parameters:
rw
- true, if you can enter/select data
isReadWrite
public boolean isReadWrite()
- Is it possible to edit
- Specified by:
isReadWrite
in interface CEditor
- Returns:
- true, if editable
setBackground
public void setBackground(boolean error)
- Set Background based on editable / mandatory / error
- Specified by:
setBackground
in interface CEditor
- Parameters:
error
- if true, set background to error color, otherwise mandatory/editable
setBackground
public void setBackground(Color bg)
- Set Background
- Overrides:
setBackground
in class JComponent
- Parameters:
bg
-
setValue
public void setValue(Object value)
- Set Editor to value
- Specified by:
setValue
in interface CEditor
- Parameters:
value
- value of the editor
getValue
public Object getValue()
- Return Editor value
- Specified by:
getValue
in interface CEditor
- Returns:
- current value
getDisplay
public String getDisplay()
- Return Display Value
- Specified by:
getDisplay
in interface CEditor
- Returns:
- displayed String value
addMouseListener
public void addMouseListener(MouseListener ml)
- Add Mouse Listener - 1-4-0 Bug.
Bug in 1.4.0 Metal: arrowButton gets Mouse Events, so add the JComboBox
MouseListeners to the arrowButton - No context menu if right-click
- Overrides:
addMouseListener
in class Component
- Parameters:
ml
- - See Also:
CompiereComboBoxUI#installUI
removeMouseListener
public void removeMouseListener(MouseListener ml)
- Remove Mouse Listener.
- Overrides:
removeMouseListener
in class Component
- Parameters:
ml
-
Copyright (c) 1999-2003 ComPiere, Inc. - Author: Jorg Janke