|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
chooser.BindingPanel
public abstract class BindingPanel
Panel containing a listing of current keybinding mappings. This contains methods that can be
overwritten to provide easy editing functionality and display logic. Note that this does not
support the manual addition or removal of BindingEntry components. However this is designed to
tolerate the changing of entry visibility (including individual fields) and the manual addition
and removal of extra components either to this panel or its BindingEntries.
This represents a mapping of keystrokes to strings, and hence duplicate shortcuts aren't
supported. An exception is made in the case of disabled shortcuts, but to keep mappings unique
duplicate actions among disabled entries are not permitted.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.BaselineResizeBehavior |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
BindingPanel()
|
Method Summary | |
---|---|
void |
clearBindings()
Removes all bindings from the panel. |
boolean |
contains(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. |
InputMap |
getBindingInputMap()
Provides an input map associating keystrokes to actions according to the contents of the display. |
LinkedHashMap<KeyStroke,String> |
getBindingMap()
Provides the mapping between keystrokes and actions represented by the contents of the display. |
ArrayList<BindingEntry> |
getBindings()
Provides listing of the current keybinding entries. |
void |
putAllBindings(Map<KeyStroke,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,
String action)
Adds a new key binding mapping to the end of the listing. |
boolean |
putBinding(KeyStroke shortcut,
String action)
Adds a new key binding mapping to the end of the listing. |
boolean |
putBinding(KeyStroke shortcut,
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. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BindingPanel()
Method Detail |
---|
public boolean putBinding(int keyCode, int modifier, 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 mapping
public boolean putBinding(KeyStroke shortcut, String action)
shortcut
- keystroke component of mappingaction
- string component of mapping
public boolean putBinding(KeyStroke shortcut, String action, int index)
shortcut
- keystroke component of mappingaction
- string component of mappingindex
- location in which to insert mapping
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 mapping
IndexOutOfBoundsException
- if index is out of range (index < 0 || index >
getBindingCount()).public void putAllBindings(Map<KeyStroke,String> bindings)
bindings
- mapping between keystrokes and actions to be addedpublic boolean removeBinding(BindingEntry entry)
entry
- binding to be removed
public BindingEntry removeBinding(int index)
index
- from which to remove entry
IndexOutOfBoundsException
- if index is out of range (index < 0 || index >
getBindingCount()).public void clearBindings()
public boolean contains(KeyStroke shortcut)
shortcut
- keystroke to be checked against contents
public int getBindingCount()
public int getBindingIndex(BindingEntry entry)
entry
- entry for which the index should be returned
public BindingEntry getBinding(int index)
index
- index from which to retrieve binding.
public ArrayList<BindingEntry> getBindings()
public LinkedHashMap<KeyStroke,String> getBindingMap()
public InputMap getBindingInputMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |