Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble with Key mappings



Hi,

MacOS X 10.2.6
Java 1.4.1 (official release)

I am having trouble trying to provide a custom key mapping set for a JTextPane. For example I want to be able to apply the user selection a given Style with a "CTRL + 1" keystrokes. Here is what I am doing:

1 - I first call my action's setKeyStroke method
KeyStroke key = action.setKeyStroke(KeyStroke.getKeyStroke(CharacterCode, modifiers));

2 - I add my custom key to the keymap
Keymap keymap = textPane.addKeymap("InsertBinding", textPane.getKeymap());
keymap.addActionForKeyStroke(key, action);

Of course I have also defined my own Action (action) object to listen to ActionEvents
I would expect that this code would trap all "CTRL + 1" keystrokea and call my action.actionPerformed() method but it is not. What am I missing?


I also noticed that If I create a custom key mapping (ALT + R) to insert a special unicode character (a plain round character in that case), I get B.b instead of just b So it looks to me that my own key binding is performed after the default applies... This is working just fine under Windows JSE1.4.1 that is to say that only b is inserted

Let me know if you need more info for this.

Thanks in advance,

Patrick Jusseau
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.