public class PJComboBox extends JComboBox implements MouseWheelListener
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManager
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
PJComboBox(se.entra.phantom.client.CComboBox owner,
ComboString[] items,
boolean alwaysEnabled)
Creates a new visual combo box.
|
Modifier and Type | Method and Description |
---|---|
void |
doLayout()
Overrides layout to pixel-fix height for Metal L&F when enabled and editable.
|
Color |
getBackground()
GetBackground, override standard method.
|
Color |
getForeground()
GetForeground, override standard method.
|
int |
getSelectedIndex()
Overrides the getSelectedIndex to return the "real" index.
|
Object |
getSelectedItem()
Overrides to returns the correct current selected item.
|
void |
grabFocus()
Control grabFocus.
|
boolean |
isFocusTraversable()
This component handles focus, so return true.
|
void |
mouseWheelMoved(MouseWheelEvent e)
Mouse wheel support.
|
void |
paint(Graphics g)
Overrides the paint method to enable drawing of a string not
in the selection but that is set anyway.
|
void |
processFocusEvent(FocusEvent fe)
Overrides the focus event to repaint correctly.
|
void |
removeAllItems()
Delete all items.
|
protected void |
selectedItemChanged()
This protected method is implementation specific.
|
void |
setBackground(Color c)
Set combo background color.
|
void |
setColors(int foregroundIndex,
int backgroundIndex)
Sets the colors for the combobox.
|
void |
setEditable(boolean editable)
Set combo editable or not.
|
void |
setEnabled(boolean isEnabled)
Overrides the JComboBox setEnabled method, in order to
handle the "Do not disable option".
|
void |
setFont(Font f)
Sets the font to be used in the combo box.
|
void |
setForeground(Color c)
Set combo foreground color.
|
void |
setModel(ComboBoxModel model)
Sets the data model that the
JComboBox uses to obtain
the list of items. |
void |
setSelectedIndex(int index)
Sets the index and if greater or equal to zero, sets the text in the entry field
(if editable).
|
void |
setSelectedItem(Object anObject)
Overrides to set the selected item, to perform nothing.
|
void |
setTextIndex(String text,
int index,
ComboString[] items)
Sets the text and the selected index, and optionally the contents.
|
void |
setUI(ComboBoxUI ui)
Overrides the setting of UI to retrieve default colors.
|
void |
updateUI()
This is a workaround for problem to update L&F when combobox has focus.
|
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, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyBinding, processKeyEvent, removeActionListener, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectWithKeyChar, setAction, setActionCommand, setEditor, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setPopupVisible, setPrototypeDisplayValue, setRenderer, showPopup
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, transferFocusDownCycle, validate, validateTree
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, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, 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, 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, transferFocusBackward, transferFocusUpCycle
public PJComboBox(se.entra.phantom.client.CComboBox owner, ComboString[] items, boolean alwaysEnabled)
public void processFocusEvent(FocusEvent fe)
processFocusEvent
in class Component
public void grabFocus()
grabFocus
in class JComponent
public boolean isFocusTraversable()
isFocusTraversable
in class Component
public void setUI(ComboBoxUI ui)
public void setColors(int foregroundIndex, int backgroundIndex)
foregroundIndex
- Foreground color index, zero for none.backgroundIndex
- Background color index, zero for none.public void setFont(Font f)
setFont
in class JComponent
f
- The new font.public Color getForeground()
getForeground
in class Component
public Color getBackground()
getBackground
in class Component
public void setForeground(Color c)
setForeground
in class JComponent
public void setBackground(Color c)
setBackground
in class JComponent
public void doLayout()
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
public void setEditable(boolean editable)
setEditable
in class JComboBox
public void setEnabled(boolean isEnabled)
setEnabled
in class JComboBox
public void setTextIndex(String text, int index, ComboString[] items)
text
- The text.index
- The index.items
- The new items if non-null.public void removeAllItems()
removeAllItems
in class JComboBox
public void setSelectedItem(Object anObject)
setSelectedItem
in class JComboBox
protected void selectedItemChanged()
selectedItemChanged
in class JComboBox
public void setSelectedIndex(int index)
setSelectedIndex
in class JComboBox
public Object getSelectedItem()
getSelectedItem
in class JComboBox
public int getSelectedIndex()
getSelectedIndex
in class JComboBox
public void paint(Graphics g)
paint
in class JComponent
public void updateUI()
public void setModel(ComboBoxModel model)
JComboBox
uses to obtain
the list of items. Overridden to remove default functionality.Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.