Package docking.widgets.combobox
Class GhidraComboBox<E>
- java.lang.Object
- 
- java.awt.Component
- 
- java.awt.Container
- 
- javax.swing.JComponent
- 
- javax.swing.JComboBox<E>
- 
- docking.widgets.combobox.GhidraComboBox<E>
 
 
 
 
 
- 
- All Implemented Interfaces:
- GComponent,- java.awt.event.ActionListener,- java.awt.image.ImageObserver,- java.awt.ItemSelectable,- java.awt.MenuContainer,- java.io.Serializable,- java.util.EventListener,- javax.accessibility.Accessible,- javax.swing.event.ListDataListener
 
 public class GhidraComboBox<E> extends javax.swing.JComboBox<E> implements GComponent GhidraComboBox adds the following features: 1) ActionListeners are only invoked when the <Enter> key is pressed within the text-field of the combo-box. In normal JComboBox case, the ActionListeners are notified when an item is selected from the list. 2) Adds the auto-completion feature. As a user types in the field, the combo box suggest the nearest matching entry in the combo box model. It also fixes the following bug: A normal JComboBox has a problem (feature?) that if you have a dialog with a button and JComboBox and you edit the comboText field and then hit the button, the button sometimes does not work. When the combobox loses focus, and its text has changed, it generates an actionPerformed event as though the user pressed <Enter> in the combo text field. This has a bizarre effect if you have added an actionPerformed listener to the combobox and in your callback you adjust the enablement state of the button that you pressed (which caused the text field to lose focus) in that you end up changing the button's internal state(by calling setEnabled(true or false)) in the middle of the button press.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classGhidraComboBox.InterceptedInputDocumentCustom Document the valid user input on the fly.- 
Nested classes/interfaces inherited from class javax.swing.JComboBoxjavax.swing.JComboBox.AccessibleJComboBox, javax.swing.JComboBox.KeySelectionManager
 - 
Nested classes/interfaces inherited from class javax.swing.JComponentjavax.swing.JComponent.AccessibleJComponent
 
- 
 - 
Field Summary- 
Fields inherited from class javax.swing.JComboBoxactionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
 - 
Fields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 - 
Fields inherited from class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 - 
Fields inherited from interface docking.widgets.GComponentHTML_DISABLE_STRING
 
- 
 - 
Constructor SummaryConstructors Constructor Description GhidraComboBox()Default constructor.GhidraComboBox(E[] items)Construct a new GhidraComboBox and populate a default model with the given items.GhidraComboBox(java.util.Vector<E> items)Construct a new GhidraComboBox and populate a default model with the given Vector of items.GhidraComboBox(javax.swing.ComboBoxModel<E> aModel)Construct a new GhidraComboBox using the given model.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddActionListener(java.awt.event.ActionListener l)voidaddDocumentListener(javax.swing.event.DocumentListener l)voidaddToModel(E obj)voidclearModel()Remove all entries in the drop down listbooleancontainsItem(E obj)java.lang.StringgetText()voidremoveActionListener(java.awt.event.ActionListener l)voidremoveDocumentListener(javax.swing.event.DocumentListener l)voidselectAll()voidsetColumnCount(int columnCount)Sets the size of the text field editor used by this combo box, if that is the type of editor used.voidsetEnterKeyForwarding(boolean forwardEnter)HACK ALERT: By default, the JComboBoxUI forwards the <Enter> key actions to the root pane of the JComboBox's container (which is used primarily by any installed 'default button').voidsetSelectedItem(java.lang.Object obj)voidsetUI(javax.swing.plaf.ComboBoxUI ui)- 
Methods inherited from class javax.swing.JComboBoxactionPerformed, actionPropertyChanged, 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, processKeyBinding, processKeyEvent, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, showPopup, updateUI
 - 
Methods inherited from class javax.swing.JComponentaddAncestorListener, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, 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.Containeradd, 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, transferFocusDownCycle, validate, validateTree
 - 
Methods inherited from class java.awt.Componentaction, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface docking.widgets.GComponentgetHTMLRenderingEnabled, setHTMLRenderingEnabled
 
- 
 
- 
- 
- 
Constructor Detail- 
GhidraComboBoxpublic GhidraComboBox() Default constructor.
 - 
GhidraComboBoxpublic GhidraComboBox(javax.swing.ComboBoxModel<E> aModel) Construct a new GhidraComboBox using the given model.- See Also:
- JComboBox(ComboBoxModel)
 
 - 
GhidraComboBoxpublic GhidraComboBox(E[] items) Construct a new GhidraComboBox and populate a default model with the given items.- See Also:
- JComboBox(Object[])
 
 - 
GhidraComboBoxpublic GhidraComboBox(java.util.Vector<E> items) Construct a new GhidraComboBox and populate a default model with the given Vector of items.- See Also:
- JComboBox(Vector)
 
 
- 
 - 
Method Detail- 
setUIpublic void setUI(javax.swing.plaf.ComboBoxUI ui) - Overrides:
- setUIin class- javax.swing.JComboBox<E>
 
 - 
setEnterKeyForwardingpublic void setEnterKeyForwarding(boolean forwardEnter) HACK ALERT: By default, the JComboBoxUI forwards the <Enter> key actions to the root pane of the JComboBox's container (which is used primarily by any installed 'default button'). The problem is that the forwarding does not happen always. In the case that the <Enter> key will trigger a selection in the combo box, the action is NOT forwarded.By default Ghidra disables the forwarding altogether, since most users of GhidraComboBoxwill add an action listener to handle <Enter> actions.To re-enable the default behavior, set the forwardEnter value to true. - Parameters:
- forwardEnter- true to enable default <Enter> key handling.
 
 - 
getTextpublic java.lang.String getText() 
 - 
setSelectedItempublic void setSelectedItem(java.lang.Object obj) - Overrides:
- setSelectedItemin class- javax.swing.JComboBox<E>
 
 - 
setColumnCountpublic void setColumnCount(int columnCount) Sets the size of the text field editor used by this combo box, if that is the type of editor used. By default the editor for combo boxes is a text field. This method is a convenience for the user to set the number of columns on that text field, which updates the preferred size of the combo box.- Parameters:
- columnCount- The number of columns for the text field editor
- See Also:
- JTextField.setColumns(int)
 
 - 
selectAllpublic void selectAll() 
 - 
clearModelpublic void clearModel() Remove all entries in the drop down list
 - 
addToModelpublic void addToModel(E obj) 
 - 
containsItempublic boolean containsItem(E obj) 
 - 
addActionListenerpublic void addActionListener(java.awt.event.ActionListener l) - Overrides:
- addActionListenerin class- javax.swing.JComboBox<E>
 
 - 
removeActionListenerpublic void removeActionListener(java.awt.event.ActionListener l) - Overrides:
- removeActionListenerin class- javax.swing.JComboBox<E>
 
 - 
addDocumentListenerpublic void addDocumentListener(javax.swing.event.DocumentListener l) 
 - 
removeDocumentListenerpublic void removeDocumentListener(javax.swing.event.DocumentListener l) 
 
- 
 
-