java.lang.Object
org.autogui.swing.util.PopupExtension.MenuKeySelector
- All Implemented Interfaces:
 EventListener,MenuKeyListener,PopupMenuListener
- Enclosing class:
 PopupExtension
public static class PopupExtension.MenuKeySelector
extends Object
implements MenuKeyListener, PopupMenuListener
a menu-selector by incremental key-typing
 
     new MenuKeySelector().addToMenu(popupMenu);
 
 select menu items by key types
- any displayable key : put it into the buffer and select a next item. if no item is found, search from the top
 - backspace, delete: clear the buffer
 - tab: no change for the buffer and search a next item
 - newline, arrow-keys, ... : no consumption of the key event
 
The order of the search is children of the current item, rest sibling items, children of rest sibling items (recursion) ... , upper rest items, children of upper rest items (recursion), ...
Matching : it uses startsWith for JMenuItem's getText()
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddToMenu(JPopupMenu menu) voidbooleanmatch(MenuElement e, String str) booleanvoidvoidvoidvoidvoidvoidvoidprocessFound(MenuSelectionManager manager, MenuElement[] found, String str) booleanvoidprocessTarget(MenuSelectionManager manager, String str) voidrun(MenuKeyEvent e) searchDown(MenuElement[] path, MenuElement[] children, MenuElement stopAt, String str) searchUp(MenuElement[] path, String str)  
- 
Field Details
- 
buffer
 
 - 
 - 
Constructor Details
- 
MenuKeySelector
public MenuKeySelector() 
 - 
 - 
Method Details
- 
addToMenu
 - 
popupMenuWillBecomeVisible
- Specified by:
 popupMenuWillBecomeVisiblein interfacePopupMenuListener
 - 
popupMenuWillBecomeInvisible
- Specified by:
 popupMenuWillBecomeInvisiblein interfacePopupMenuListener
 - 
popupMenuCanceled
- Specified by:
 popupMenuCanceledin interfacePopupMenuListener
 - 
clearBuffer
public void clearBuffer() - 
run
 - 
processKeyInput
 - 
processTarget
 - 
processFound
 - 
searchDown
public MenuElement[] searchDown(MenuElement[] path, MenuElement[] children, MenuElement stopAt, String str)  - 
searchUp
 - 
match
 - 
matchText
 
 -