KeyMap [message #437479] |
Fri, 04 June 2004 16:23 |
Eclipse User |
|
|
|
Originally posted by: renzo1977.tiscali.it
I want change the kaymap of a SWT Text (or StyledText) to implement the
intellisense, but I'm not able to do it for Text, and for styledText I can
use only the method text.setKeyBinding(int key, int action); and I can't
set my Action.
Swing Example:
private void addPopupKeyMap()
{
// getKeymap() is a JTextPane method to have the key map for that object
// I defined originalKeyMap and popupKeyMap externally
originalKeyMap = getKeymap();
popupKeyMap = addKeymap("popupBindigs",originalKeyMap);
// PopupScrollAction is the costructor of my Action and when keypressed
// button down exec my instruction
Action action = new PopupScrollAction(1);
KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0);
// Redefine the map and so on
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupScrollAction(-1);
key = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupScrollAction(-5);
key = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupScrollAction(5);
key = KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupCopyTextAction();
key = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
popupKeyMap.addActionForKeyStroke(key, action);
action = new PopupCloseAction();
key = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
popupKeyMap.addActionForKeyStroke(key, action);
}
Sorry for my english for first and please help me....
|
|
|
Powered by
FUDForum. Page generated in 0.03092 seconds