Page 1 of 1

Custom key binding in oXygen applet

Posted: Mon Jan 16, 2012 6:01 pm
by Ruskiz
Hi.
How to add custom key bindings for the applet?
I need add CTRL+S for "Save" action (and on custom action), because by default is not work.
Thank you.

Re: Custom key binding in oXygen applet

Posted: Mon Jan 16, 2012 6:06 pm
by Radu
Hi,

The applet is based on Swing components, so on the AuthorComponentSample constructor you can add code like:

Code: Select all

getActionMap().put("SAVE_APPLET", myAction);
getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK), "SAVE_APPLET");
Regards,
Radu

Re: Custom key binding in oXygen applet

Posted: Tue Jan 17, 2012 1:54 pm
by Ruskiz
Thank you. This is what I needed.