Hi,
I've got an application consisting of a JPanel containing an image and some focusable controls. Initially the focusable controls are disabled so that the panel has the focus. I want the image to be zoomed in / out if a specific button is typed. The shortcuts shall be executed independent of the control that has the focus. I'm doing that using the JPanels InputMap and ActionMap.
The javadoc states for JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
Constant used for registerKeyboardAction that means that the command should be invoked when the receiving component is an ancestor of the focused component or is itself the focused component.
Because of that my first attempt was the following:
Contrary to the javadoc, the related actions have not been executed if the panel itself has been focused.
To get my application to work as imagined, I need to do the following:
Can anyone explain to me why my first attempt is not working as I thought it would do, please?
Thank you
Tina