I have a component inside a JInternalFrame which needs to perform actions when keys are pressed within the JInternalFrame's parenting window. Using InputMap/ActionMap would be ideal, but the getInputMap(WHEN_IN_FOCUSED_WINDOW) of the component returns an InputMap 开发者_运维技巧that treats the JInternalFrame as the "focused window", rather than its parenting window. Any solutions or ideas?
Bindings mapped to the desktop pane use WHEN_ANCESTOR_OF_FOCUSED_COMPONENT. Maybe that is what you want.
Otherwise, if you need more help post your SSCCE that demonstrates the problem.
精彩评论