public abstract class BindingPanel extends TransparentPanel
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
BindingPanel()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clearBindings()
Removes all bindings from the panel.
|
boolean |
contains(javax.swing.KeyStroke shortcut)
Returns if a keystroke is in the panel's current contents.
|
BindingEntry |
getBinding(int index)
Provides a binding at a particular index.
|
int |
getBindingCount()
Provides number of key bindings currently present.
|
int |
getBindingIndex(BindingEntry entry)
Provides the index of a particular entry.
|
javax.swing.InputMap |
getBindingInputMap()
Provides an input map associating keystrokes to actions according to the
contents of the display.
|
java.util.LinkedHashMap<javax.swing.KeyStroke,java.lang.String> |
getBindingMap()
Provides the mapping between keystrokes and actions represented by the
contents of the display.
|
java.util.ArrayList<BindingEntry> |
getBindings()
Provides listing of the current keybinding entries.
|
protected abstract void |
onClick(java.awt.event.MouseEvent event,
BindingEntry entry,
BindingEntry.Field field)
Method called upon any mouse clicks within a BindingEntry in the display.
|
protected abstract void |
onUpdate(int index,
BindingEntry entry,
boolean isNew)
Method called whenever an entry is either added or shifts in the display.
|
void |
putAllBindings(java.util.Map<javax.swing.KeyStroke,java.lang.String> bindings)
Adds a collection of new key binding mappings to the end of the listing.
|
boolean |
putBinding(BindingEntry newEntry,
int index)
Adds a new key binding mapping to a particular index of the listing.
|
boolean |
putBinding(int keyCode,
int modifier,
java.lang.String action)
Adds a new key binding mapping to the end of the listing.
|
boolean |
putBinding(javax.swing.KeyStroke shortcut,
java.lang.String action)
Adds a new key binding mapping to the end of the listing.
|
boolean |
putBinding(javax.swing.KeyStroke shortcut,
java.lang.String action,
int index)
Adds a new key binding mapping to a particular index of the listing.
|
boolean |
removeBinding(BindingEntry entry)
Removes a particular binding from the contents.
|
BindingEntry |
removeBinding(int index)
Removes the binding at a particular index of the listing.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, 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, 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
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, 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, transferFocusBackward, transferFocusUpCycle
protected abstract void onUpdate(int index, BindingEntry entry, boolean isNew)
index
- newly assigned index of entryentry
- entry that has been added or shiftedisNew
- if true the entry is new to the display, false otherwiseprotected abstract void onClick(java.awt.event.MouseEvent event, BindingEntry entry, BindingEntry.Field field)
event
- fired mouse event that triggered method callentry
- entry on which the click landedfield
- field of entry on which the click landed, null if not a
recognized fieldpublic boolean putBinding(int keyCode, int modifier, java.lang.String action)
bindingPanel.putBinding('Y', 0, "Confirm Selection"); bindingPanel.putBinding(KeyEvent.VK_DELETE, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK, "Kill Process");
keyCode
- key code of keystroke component of mappingmodifier
- modifiers of keystroke component of mappingaction
- string component of mappingpublic boolean putBinding(javax.swing.KeyStroke shortcut, java.lang.String action)
shortcut
- keystroke component of mappingaction
- string component of mappingpublic boolean putBinding(javax.swing.KeyStroke shortcut, java.lang.String action, int index)
shortcut
- keystroke component of mappingaction
- string component of mappingindex
- location in which to insert mappingjava.lang.IndexOutOfBoundsException
- if index is out of range (index < 0 ||
index > getBindingCount()).public boolean putBinding(BindingEntry newEntry, int index)
newEntry
- entry to add to contentsindex
- location in which to insert mappingjava.lang.IndexOutOfBoundsException
- if index is out of range (index < 0 ||
index > getBindingCount()).public void putAllBindings(java.util.Map<javax.swing.KeyStroke,java.lang.String> bindings)
bindings
- mapping between keystrokes and actions to be addedpublic boolean removeBinding(BindingEntry entry)
entry
- binding to be removedpublic BindingEntry removeBinding(int index)
index
- from which to remove entryjava.lang.IndexOutOfBoundsException
- if index is out of range (index < 0 ||
index > getBindingCount()).public void clearBindings()
public boolean contains(javax.swing.KeyStroke shortcut)
shortcut
- keystroke to be checked against contentspublic int getBindingCount()
public int getBindingIndex(BindingEntry entry)
entry
- entry for which the index should be returnedpublic BindingEntry getBinding(int index)
index
- index from which to retrieve binding.public java.util.ArrayList<BindingEntry> getBindings()
public java.util.LinkedHashMap<javax.swing.KeyStroke,java.lang.String> getBindingMap()
public javax.swing.InputMap getBindingInputMap()
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.