|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JComboBox com.cosylab.gui.components.SimpleComboBox
public class SimpleComboBox
A simple implementation of a combo box that provides several display styles through different javax.swing.plaf.ComboBoxUI implementations. These can be set through setStyle(int) method and are enumerated as: SIMPLE_STYLE displays no button in the comboBox. Items are selected from a drop down list activated on mouseclick. DROP_DOWN_STYLE displays an arrowed button on the right side of the combo box that activates the drop down list. SWITCH_STYLE_POPUP_ENABLED positions two buttons on each side of the combo box that can be used to switch between items of the combo box, while the complete list of items can still be accesed by mouseclick on the selected item cell. SWITCH_STYLE_POPUP_DISABLED has the same features as SWITCH_STYLE_POPUP_ENABLED but the drop-down list is no longer available to the user. The method setUI(javax.swing.plaf.ComboBoxUI) has been overrriden to accept only SimpleComboBoxUI instances. In addition SimpleComboBox accepts custom renderer to be set to rendere only the selected item cell differently from all the other items in the drop-down list. This renderer can be set through setSelectedItemRenderer(ListCellRenderer). If null, the default renderer is used.
Nested Class Summary | |
---|---|
static class |
SimpleComboBox.DropComboBoxUI
This extension of SimpleComboBoxUI uses the standard right-side arrow button to activate the drop-down list. |
static class |
SimpleComboBox.SimpleComboBoxUI
The simplest implementation od ComboBoxUI displays no button in the comboBox. |
static class |
SimpleComboBox.Style
|
static class |
SimpleComboBox.SwitchComboBoxUI
|
Nested classes/interfaces inherited from class javax.swing.JComboBox |
---|
javax.swing.JComboBox.AccessibleJComboBox, javax.swing.JComboBox.KeySelectionManager |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
DROP_DOWN_STYLE
Deprecated. |
static int |
SIMPLE_STYLE
Deprecated. |
static int |
SWITCH_STYLE_POPUP_DISABLED
Deprecated. |
static int |
SWITCH_STYLE_POPUP_ENABLED
Deprecated. |
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 java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
SimpleComboBox()
Constructor for SimpleComboBox. |
|
SimpleComboBox(javax.swing.ComboBoxModel aModel)
Constructor for SimpleComboBox. |
|
SimpleComboBox(java.lang.Object[] items)
Constructor for SimpleComboBox. |
|
SimpleComboBox(java.util.Vector items)
Constructor for SimpleComboBox. |
Method Summary | |
---|---|
javax.swing.ListCellRenderer |
getSelectedItemRenderer()
Returns the selectedItemRenderer. |
int |
getStyle()
Returns the style. |
static void |
main(java.lang.String[] args)
For testing and demonstration purposes only. |
void |
setEnabled(boolean b)
|
void |
setSelectedItemRenderer(javax.swing.ListCellRenderer newSelectedItemRenderer)
Sets the selectedItemRenderer. |
void |
setStyle(int newStyle)
Deprecated. use setStyle(Style) |
void |
setStyle(SimpleComboBox.Style newStyleE)
|
void |
setUI(javax.swing.plaf.ComboBoxUI ui)
This method has been overriden to enforce usage of SimpleComboBoxUI. |
Methods inherited from class javax.swing.JComboBox |
---|
actionPerformed, actionPropertyChanged, 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, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, showPopup, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int SIMPLE_STYLE
public static int DROP_DOWN_STYLE
public static int SWITCH_STYLE_POPUP_ENABLED
public static int SWITCH_STYLE_POPUP_DISABLED
Constructor Detail |
---|
public SimpleComboBox(javax.swing.ComboBoxModel aModel)
aModel
- JComboBox.JComboBox(ComboBoxModel)
public SimpleComboBox(java.lang.Object[] items)
items
- JComboBox.JComboBox(Object[])
public SimpleComboBox(java.util.Vector items)
items
- JComboBox.JComboBox(Vector)
public SimpleComboBox()
JComboBox.JComboBox()
Method Detail |
---|
public void setUI(javax.swing.plaf.ComboBoxUI ui)
setUI
in class javax.swing.JComboBox
ui
- ComboBoxUIJComboBox.setUI(ComboBoxUI)
public javax.swing.ListCellRenderer getSelectedItemRenderer()
public void setEnabled(boolean b)
setEnabled
in class javax.swing.JComboBox
public void setSelectedItemRenderer(javax.swing.ListCellRenderer newSelectedItemRenderer)
newSelectedItemRenderer
- The selectedItemRenderer to set. If null,
the selected item is rendered with the common list cell renderer
of the combo box.JComboBox.setRenderer(ListCellRenderer)
public int getStyle()
public void setStyle(SimpleComboBox.Style newStyleE)
public void setStyle(int newStyle)
setStyle(Style)
newStyle
- int the style to be used by this SimpleComboBoxpublic static void main(java.lang.String[] args)
args
- String[]
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |