means that if I press ALT + N, the cursor will take this name, introducing the field
This is usually done using JLabel / JTextField pairs. Sort of:
JLabel firstNameLabel = new JLabel("First Name"); JTextField firstNameTextField(15); firstNameLabel.setLabelFor( firstNameTextField ); firstNameLabel.setDisplayedMnemonic( 'F' ); panel.add( firstNameLabel ); panel.add( firstNameTextField );
Then, using Alt-F, the focus on the text field will be set.
Key bindings will be done automatically for you.
source share