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:
FocusableEditor,ImageObserver,MenuContainer,Serializable,Accessible
Panel for user input of addresses. Handles case with multiple address
spaces.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for AddressInput.AddressInput(Border border) Constructor for AddressInput. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActionListener(ActionListener listener) Add an action listener that will be notified anytime the user presses the return key while in the text field.voidaddChangeListener(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.booleanvoidCalled with the editor should take focus.Returns the address in the field or null if the address can't be parsed.Returns the address space selected in the combobox or in the input text itself if specified (eg: "register:1").protected JTextFieldprotected JTextFieldgetValue()Get the offset part of the address field.booleanhasInput()Returns true if the Address input field contains text.booleanbooleanvoidremoveActionListener(ActionListener listener) Removes the action listener from the list to be notified.voidvoidselect()Select the text field that is the offset.voidSets 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, boolean allowOtherSpace) 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) voidSet the offset part of the address field.voidshowAddressSpaceCombo(boolean showCombo) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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
-
Constructor Details
-
AddressInput
Constructor for AddressInput.- Parameters:
border- border around each subcomponent (combo/text fields).
-
AddressInput
public AddressInput()Constructor for AddressInput.
-
-
Method Details
-
setAddress
Set the field to display the given address -
getAddress
Returns the address in the field or null if the address can't be parsed.- Throws:
NullPointerException- if AddressFactory has not been set.
-
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:
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
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
-
setAddressFactory
public void setAddressFactory(AddressFactory factory, boolean filterOverlaySpaces, boolean allowOtherSpace) 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.allowOtherSpace- true if the OTHER space should 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
Get the offset part of the address field.- Returns:
- String
-
setValue
Set the offset part of the address field.- Parameters:
value- the offset value string
-
isEnabled
public boolean isEnabled() -
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
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
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
Removes the action listener from the list to be notified.- Parameters:
listener-
-
setEnabled
public void setEnabled(boolean enabled) - Overrides:
setEnabledin classJComponent- See Also:
-
setEditable
public void setEditable(boolean state) Set the text field to be editable according to the state param. -
isEditable
public boolean isEditable() -
focusEditor
public void focusEditor()Description copied from interface:FocusableEditorCalled with the editor should take focus.- Specified by:
focusEditorin interfaceFocusableEditor
-
showAddressSpaceCombo
public void showAddressSpaceCombo(boolean showCombo) -
requestFocus
public void requestFocus()- Overrides:
requestFocusin classJComponent
-
getAddressTextField
-
getAddressSpaceTextField
-