|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.plaf.basic.BasicPopupMenuUI.MenuKeyboardHelper
This helper is added to MenuSelectionManager as a ChangeListener to listen to menu selection changes. When a menu is activated, it passes focus to its parent JRootPane, and installs an ActionMap/InputMap pair on that JRootPane. Those maps are necessary in order for menu navigation to work. When menu is being deactivated, it restores focus to the component that has had it before menu activation, and uninstalls the maps. This helper is also installed as a KeyListener on root pane when menu is active. It forwards key events to MenuSelectionManager for mnemonic keys handling.
Field Summary | |
private boolean |
focusTraversalKeysEnabled
|
private JRootPane |
invokerRootPane
|
private Component |
lastFocused
|
private MenuElement[] |
lastPathSelected
|
private JPopupMenu |
lastPopup
|
private ActionMap |
menuActionMap
|
private InputMap |
menuInputMap
|
private boolean |
receivedKeyPressed
|
private FocusListener |
rootPaneFocusListener
|
Constructor Summary | |
private |
BasicPopupMenuUI.MenuKeyboardHelper()
|
Method Summary | |
(package private) void |
addUIActionMap(JComponent c,
ActionMap map)
|
(package private) void |
addUIInputMap(JComponent c,
InputMap map)
|
(package private) JPopupMenu |
getActivePopup(MenuElement[] path)
Return the last JPopupMenu in path ,
or null if none found |
void |
keyPressed(KeyEvent ev)
Invoked when a key has been pressed. |
void |
keyReleased(KeyEvent ev)
Invoked when a key has been released. |
void |
keyTyped(KeyEvent ev)
Invoked when a key has been typed. |
(package private) void |
removeItems()
|
(package private) void |
removeUIActionMap(JComponent c,
ActionMap map)
|
(package private) void |
removeUIInputMap(JComponent c,
InputMap map)
|
void |
stateChanged(ChangeEvent ev)
Invoked when the target of the listener has changed its state. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private Component lastFocused
private MenuElement[] lastPathSelected
private JPopupMenu lastPopup
private JRootPane invokerRootPane
private ActionMap menuActionMap
private InputMap menuInputMap
private boolean focusTraversalKeysEnabled
private boolean receivedKeyPressed
private FocusListener rootPaneFocusListener
Constructor Detail |
private BasicPopupMenuUI.MenuKeyboardHelper()
Method Detail |
void removeItems()
JPopupMenu getActivePopup(MenuElement[] path)
path
,
or null
if none found
void addUIInputMap(JComponent c, InputMap map)
void addUIActionMap(JComponent c, ActionMap map)
void removeUIInputMap(JComponent c, InputMap map)
void removeUIActionMap(JComponent c, ActionMap map)
public void stateChanged(ChangeEvent ev)
ChangeListener
stateChanged
in interface ChangeListener
ev
- a ChangeEvent objectpublic void keyPressed(KeyEvent ev)
KeyListener
KeyEvent
for a definition of
a key pressed event.
keyPressed
in interface KeyListener
public void keyReleased(KeyEvent ev)
KeyListener
KeyEvent
for a definition of
a key released event.
keyReleased
in interface KeyListener
public void keyTyped(KeyEvent ev)
KeyListener
KeyEvent
for a definition of
a key typed event.
keyTyped
in interface KeyListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |