tags:

views:

35

answers:

1

I have a java applet that is used as a drawing tool. Across the top of the applet I have several buttons and other widgets that allow the user to draw/modify/erase various features on the "canvas".

I have a requirement of adding some key binds that act as short cuts as well as providing some other features. I have a key listener defined in my JPanel ( I may break it out later ). I need all of the components on my applet to have these key binds and to do the same thing. Currently, the only thing I know to do is to register the listener with each component.

Is this there a better design pattern/structure that I am missing?

Thanks.

+4  A: 

For keys binds, don't use key listener, use keys bindings : How to Use Key Bindings.

Istao
Thanks for the link.
HeathLilley