Package ghidra.app.util
Class AddressInput
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- ghidra.app.util.AddressInput
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
public class AddressInput extends javax.swing.JPanelPanel for user input of addresses. Handles case with multiple address spaces.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description AddressInput()Constructor for AddressInput.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddActionListener(java.awt.event.ActionListener listener)Add an action listener that will be notified anytime the user presses the return key while in the text field.voidaddChangeListener(javax.swing.event.ChangeListener listener)Adds a change listener that will be notified anytime this address value in this panel changesvoidclear()Clear the offset part of the address field.booleancontainsAddressSpaces()AddressgetAddress()Returns the address in the field or null if the address can't be parsed.AddressFactorygetAddressFactory()AddressSpacegetAddressSpace()Returns the address space selected in the combobox or in the input text itself if specified (eg: "register:1").protected javax.swing.JTextFieldgetAddressSpaceTextField()protected javax.swing.JTextFieldgetAddressTextField()java.lang.StringgetValue()Get the offset part of the address field.booleanhasInput()Returns true if the Address input field contains text.booleanisEditable()booleanisEnabled()voidremoveActionListener(java.awt.event.ActionListener listener)Removes the action listener from the list to be notified.voidrequestFocus()voidselect()Select the text field that is the offset.voidselectDefaultAddressSpace()Sets the selected combo box item to the default address space.voidsetAddress(Address addr)Set the field to display the given addressvoidsetAddressFactory(AddressFactory factory)Set the address factory to be used to parse addresses.voidsetAddressFactory(AddressFactory factory, boolean filterOverlaySpaces)Set the address factory to be used to parse addresses.voidsetAddressSpaceEditable(boolean state)Set the address space (if it is shown) such that it is not editable.voidsetEditable(boolean state)Set the text field to be editable according to the state param.voidsetEnabled(boolean enabled)voidsetValue(java.lang.String value)Set the offset part of the address field.voidshowAddressSpaceCombo(boolean showCombo)-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, 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
-
-
-
-
Method Detail
-
setAddress
public void setAddress(Address addr)
Set the field to display the given address
-
getAddress
public Address getAddress()
Returns the address in the field or null if the address can't be parsed.- Throws:
java.lang.NullPointerException- if AddressFactory has not been set.
-
getAddressSpace
public AddressSpace getAddressSpace()
Returns the address space selected in the combobox or in the input text itself if specified (eg: "register:1"). If the address space is not specified; returns the default space.- Throws:
java.lang.NullPointerException- if AddressFactory has not been set.
-
hasInput
public boolean hasInput()
Returns true if the Address input field contains text. The getAddress() method will return null if text is not a valid address.
-
setAddressFactory
public void setAddressFactory(AddressFactory factory)
Set the address factory to be used to parse addresses. Also used to set the combo box with the list of valid address spaces if there is more than one space.
-
getAddressFactory
public AddressFactory getAddressFactory()
-
setAddressFactory
public void setAddressFactory(AddressFactory factory, boolean filterOverlaySpaces)
Set the address factory to be used to parse addresses. Also used to set the combo box with the list of valid address spaces if there is more than one space.- Parameters:
factory- address factory to usefilterOverlaySpaces- true if overlay spaces should not appear in the combo box for the address spaces.
-
selectDefaultAddressSpace
public void selectDefaultAddressSpace()
Sets the selected combo box item to the default address space.
-
clear
public void clear()
Clear the offset part of the address field.
-
select
public void select()
Select the text field that is the offset.
-
getValue
public java.lang.String getValue()
Get the offset part of the address field.- Returns:
- String
-
setValue
public void setValue(java.lang.String value)
Set the offset part of the address field.- Parameters:
value- the offset value string
-
isEnabled
public boolean isEnabled()
- Overrides:
isEnabledin classjava.awt.Component
-
containsAddressSpaces
public boolean containsAddressSpaces()
-
setAddressSpaceEditable
public void setAddressSpaceEditable(boolean state)
Set the address space (if it is shown) such that it is not editable. If the combo box is shown for multiple address spaces, then the combo box is replaced with a fixed uneditable text field that shows the currently selected address space.- Parameters:
state- false means that the combo box should not be editable
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener listener)
Adds a change listener that will be notified anytime this address value in this panel changes- Parameters:
listener- the change listener to be notified.
-
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
Add an action listener that will be notified anytime the user presses the return key while in the text field.- Parameters:
listener- the action listener to be notified.
-
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
Removes the action listener from the list to be notified.- Parameters:
listener-
-
setEnabled
public void setEnabled(boolean enabled)
- Overrides:
setEnabledin classjavax.swing.JComponent- See Also:
Component.setEnabled(boolean)
-
setEditable
public void setEditable(boolean state)
Set the text field to be editable according to the state param.
-
isEditable
public boolean isEditable()
-
showAddressSpaceCombo
public void showAddressSpaceCombo(boolean showCombo)
-
requestFocus
public void requestFocus()
- Overrides:
requestFocusin classjavax.swing.JComponent
-
getAddressTextField
protected javax.swing.JTextField getAddressTextField()
-
getAddressSpaceTextField
protected javax.swing.JTextField getAddressSpaceTextField()
-
-