How to register KeyStroke on JXDatePicker

I need to shift focus to another element when the user presses the Enter key, so I managed to register a KeyStroke for most elements this way:

this.getInputMap( ).put( KeyStroke.getKeyStroke( '\n' ), "transferFokus" ); this.getActionMap( ).put( "transferFokus", transferFokusa ); 

everything works fine except for my class, which extends JXDatePicker, which I suppose consumes the input key inside. What can I do?

The thing is to make it easier for people to use the GUI, since they worked on an old DOS application in which they move inside the form using Enter instead of the TAB key.

+4
source share
1 answer

From javadoc, it looks like JXDatePicker is using JFormattedTextField for a real editing component for a date string. JXDatePicker.getEditor () returns a text field, so maybe you should try calling getInputMap () and getActionMap () in the text field?

+3
source